Last modified: 2011-03-13 20:56:54 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T29340, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27340 - API: Allow listing of "small" categories
API: Allow listing of "small" categories
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.18.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-11 22:00 UTC by db [inactive,noenotif]
Modified: 2011-03-13 20:56 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description db [inactive,noenotif] 2011-02-11 22:00:32 UTC
Please add a min/max param to list=allcategories to allow listing of categories with a certain number/range of categorymembers. Thanks.
Comment 1 Sam Reed (reedy) 2011-02-11 22:12:05 UTC
What is the point of this?

Anyway, there is no sane way of doing this query, so it's WONTFIX
Comment 2 Bryan Tong Minh 2011-02-11 22:12:53 UTC
There is an index on cat_pages which can be used for this, but we need to take care that we use the proper index for sorting.
Comment 3 Sam Reed (reedy) 2011-03-13 16:49:49 UTC
Note, the index is only on cat_pages

So this is only doable for the number of cat_pages, NOT cat_subcats or cat_files, so would need extra indexes adding for the latter if it's desired...
Comment 4 Sam Reed (reedy) 2011-03-13 17:03:22 UTC
Ok, poking at this.

If we just filter by the cat_pages, it's fine. If we then order by anything (cat_title or cat_pages), we create a filesort.

This basically means we can't do both pages and title filtering together... (Would need to be mutually exclusive)

Though, I just noticed, if we do WHERE cl_title >= something, and order by, it filesorts....
Comment 5 Sam Reed (reedy) 2011-03-13 17:06:49 UTC
(In reply to comment #4)
> Ok, poking at this.
> 
> If we just filter by the cat_pages, it's fine. If we then order by anything
> (cat_title or cat_pages), we create a filesort.
> 
> This basically means we can't do both pages and title filtering together...
> (Would need to be mutually exclusive)
> 
> Though, I just noticed, if we do WHERE cl_title >= something, and order by, it
> filesorts....

Seemingly, just on the version of mysql my vm is running. FFS
Comment 6 Sam Reed (reedy) 2011-03-13 17:17:47 UTC
r83833
Comment 7 Bryan Tong Minh 2011-03-13 18:36:34 UTC
(In reply to comment #3)
> Note, the index is only on cat_pages
> 
> So this is only doable for the number of cat_pages, NOT cat_subcats or
> cat_files, so would need extra indexes adding for the latter if it's desired...
cat_pages includes cat_files and cat_subcats.
Comment 8 Sam Reed (reedy) 2011-03-13 18:37:54 UTC
(In reply to comment #7)
> (In reply to comment #3)
> > Note, the index is only on cat_pages
> > 
> > So this is only doable for the number of cat_pages, NOT cat_subcats or
> > cat_files, so would need extra indexes adding for the latter if it's desired...
> cat_pages includes cat_files and cat_subcats.

Duh. Helps if I read the text in tables.sql properly
Comment 9 Roan Kattouw 2011-03-13 20:47:13 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Ok, poking at this.
> > 
> > If we just filter by the cat_pages, it's fine. If we then order by anything
> > (cat_title or cat_pages), we create a filesort.
> > 
> > This basically means we can't do both pages and title filtering together...
> > (Would need to be mutually exclusive)
> > 
> > Though, I just noticed, if we do WHERE cl_title >= something, and order by, it
> > filesorts....
> 
> Seemingly, just on the version of mysql my vm is running. FFS
Depends on which index is chosen. When you use cl_title >= 'foo' with ORDER BY cat_pages , MySQL can either use the cat_pages index for ordering and resolve the WHERE by scanning rows and dropping them if they don't satisfy the condition, or it can use the cl_title index for quickly obtaining all rows that satisfy the WHERE clause then filesort that.

For this reason, the code committed for fixing this bug is likely to produce inefficient queries. I'll comment on that in more detail on CodeReview.
Comment 10 Sam Reed (reedy) 2011-03-13 20:48:25 UTC
Interestingly, I was looking at this.

It filesorted locally, but doing DESCRIBE query; on WMF it didn't....
Comment 11 Roan Kattouw 2011-03-13 20:56:54 UTC
(In reply to comment #10)
> Interestingly, I was looking at this.
> 
> It filesorted locally, but doing DESCRIBE query; on WMF it didn't....
Part of the choice seems to be informed by the size of the table and the cardinality of the index (MySQL's perception of the degree of 'uniqueness' of non-unique indexes, AIUI) and probably a few other things as well, which are very different on WMF compared to your box :)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links