? ? ? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
9 Mar 2017

Pull Request for Issue # .

Related to #5544

Summary of Changes

Main Improvement:

  • remove subquery with "badcats" from frontend queries.
  • recursive update column published for children items, column published is re-calculated on every save, change state, move or copy for #__categories and #__menu (in general for subclasses of JTableNested).

In order to not display unpublished categories on front end old installation has to call additional query.
That query re-calculates published column for whole tree.

After apply patch on exists installation you have to run 2 queries from:
[Chose your database]

* administrator/components/com_admin/sql/updates/mysql/3.7.0-2017-03-09.sql
* administrator/components/com_admin/sql/updates/postgresql/3.7.0-2017-03-09.sql
* administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2017-03-09.sql

A new Rules for nested tables like (category, menu):

  • If parent will be published then there is no action or restrictions for children
  • If parent will be archived then all published children will be set as archived
  • If parent will be unpublished then all published/archived will be set as unpublished
  • If parent will be trashed then all children will be trashed

Old behaviour:

  • On save, move or copy category (or menu) then is no exists any recursion for published column. There could be published subcategory in non published category.
  • On publish/unpiblish/archive/trash category/menu all children has been recursive update to the same state.
  • You can create published category on unpublished parent.
  • On frontend query (related to articles), the query has to check ("badcats") if all category parents has the correct state (ex. published = 1)

New bevaviour

  • On all action like save/move/copy/change state recursion is call and change children state.
  • published column of children items is changed based on the rules.
  • If you create a new category (as published) on unpublished parent, then the new category also be unpiblished.
  • Frontend queries does not need to include subquery with "badcats" because last child has calculated state of published column.

Testing Instructions

Test categories, menus and articles on front end and on back end.

[UPDATED]

  • Create a new category/menu as published on non published category, result: non published
  • Change state on category with children, see recursive
  • Move some (sub tree of) category to other ex. unpublished category.
  • Changing published state at edit form of category/menu give the same result as in categories/menu list by click [Publish/Archive...]. There should be no difference where you change the published state.

All above points should follow the rules.

Expected result

Joomla should work as before but faster on frontend views: featured/blog/list/archived/article and on others which use model from components/com_content/models/articles.php like mod_articles...

Actual result

On front end with lots of categories and articles Joomla works slow.

Documentation Changes Required

I do not know.
Special subquery (badcats) for nested tables are now not required.
The new rules in JTableNested which change published state for children.

avatar csthomas csthomas - open - 9 Mar 2017
avatar csthomas csthomas - change - 9 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Mar 2017
Category SQL Administration com_admin Postgresql MS SQL Front End com_contact com_content Libraries
avatar csthomas csthomas - change - 9 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 9 Mar 2017
Category SQL Administration com_admin Postgresql MS SQL Front End com_contact com_content Libraries SQL Administration com_admin Postgresql MS SQL Front End com_contact com_content Libraries Unit Tests
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Mar 2017

After save new Menu (Smart Search) got:
bildschirmfoto 2017-03-10 um 08 15 04
Menu is saved. Save Articles and Categories works.

avatar csthomas csthomas - change - 10 Mar 2017
Labels Added: ?
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 10 Mar 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Mar 2017

I have tested this item successfully on b90d333

Tested (Back- and if possible Frontend):

avatar csthomas csthomas - change - 10 Mar 2017
The description was changed
avatar csthomas csthomas - edited - 10 Mar 2017
avatar laoneo
laoneo - comment - 10 Mar 2017

Just as a pass by comment. How was the old behavior? We need to make sure we don't introduce here a different behavior than it was before. Perhaps it is better to target this PR against J4?

avatar csthomas
csthomas - comment - 10 Mar 2017

Old behaviour IMO is incomplete (category, menu):

  • if you change state in lists of categories/menus (button Publish,..): recursive change children to the same state. (My PR do almost the same, but add some rules)
  • if you change state in edit form: there is no recursion at all
avatar csthomas csthomas - edited - 10 Mar 2017
avatar csthomas csthomas - change - 11 Mar 2017
The description was changed
avatar csthomas csthomas - edited - 11 Mar 2017
avatar csthomas csthomas - change - 11 Mar 2017
The description was changed
avatar csthomas csthomas - edited - 11 Mar 2017
avatar csthomas
csthomas - comment - 11 Mar 2017

I have updated a description to be more understandable.

avatar klas klas - test_item - 27 Mar 2017 - Tested successfully
avatar klas
klas - comment - 27 Mar 2017

I have tested this item successfully on b90d333

On category list of 100 articles (out of 10.000) I get 13% decrease in categories stats query and 6% on articles query. Behaviour seems much more consistent now


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14439.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2017

RTC as there are 3 successfully Tests?

avatar jeckodevelopment jeckodevelopment - change - 28 Mar 2017
Title
Speed up display articles by removing subquery of unpublished categories
Speed up display articles by removing subquery of unpublished categories (badcats)
avatar jeckodevelopment jeckodevelopment - edited - 28 Mar 2017
avatar csthomas
csthomas - comment - 28 Mar 2017

Thanks for tests.

If approvers has a problem with take a decision about merge it to J3.7 then may take a look at simpler PR #13242 only for menu items.

IMHO if this PR will be merged then #13242 won't be needed.

avatar jeckodevelopment jeckodevelopment - change - 28 Mar 2017
Status Pending Ready to Commit
Labels
avatar jeckodevelopment
jeckodevelopment - comment - 28 Mar 2017

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14439.

avatar rdeutz
rdeutz - comment - 30 Mar 2017

Some code style issues needs fixing

avatar csthomas
csthomas - comment - 30 Mar 2017

Code Style error does not belong to this PR. Take a look at 5d4539a#diff-283548acdd3d39b1c48e6779d916336dR246

avatar csthomas
csthomas - comment - 30 Mar 2017

I have added a PR fix at #15016

avatar rdeutz
rdeutz - comment - 30 Mar 2017

Ok, merging the other one we CI processes done

avatar rdeutz rdeutz - change - 30 Mar 2017
Title
Speed up display articles by removing subquery of unpublished categories (badcats)
Speed up display articles by removing subquery of unpublished categories
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-03-30 22:10:46
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 30 Mar 2017
avatar rdeutz rdeutz - merge - 30 Mar 2017

Add a Comment

Login with GitHub to post a comment