Closed Bug 632718 Opened 14 years ago Closed 14 years ago

Only return 500 results unless the user specifically requests to see more

Categories

(Bugzilla :: Query/Bug List, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: mkanat, Assigned: mkanat)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

Time spent in searching the database can be broken down into basically these things: 1) The query analysis and parsing done by the database engine. 2) The actual locating of data using the parsed query. 3) The actual delivery of data from the database to Bugzilla. 4) The rendering of the results. Of these, it's 3+4 that actually take most of the time--1+2 are usually almost instantaneous. Most people rarely need to see more than 500 results in a search, at the most. So, to speed up searches, we can, by default, limit every search to 500 results. Then if there are more results (which we can know by doing an actual database-side limit of 501) we can provide a link on the buglist that will re-run the query and have it display *all* the results (but subject to the limit set by bug 632717).
Priority: -- → P1
Target Milestone: --- → Bugzilla 4.2
This will only affect the HTML interface--all programmatic interfaces will still always return the full results.
Attached patch v1 (obsolete) — Splinter Review
So, here's a patch that does this, but it doesn't seem to actually help our performance. Since we have an ORDER BY clause (and a GROUP BY clause) on our SQL, the database runs the whole search before taking LIMIT into account.
Assignee: query-and-buglist → mkanat
Status: NEW → ASSIGNED
Oh, I guess it does still help in many cases, actually: http://dev.mysql.com/doc/refman/5.0/en/limit-optimization.html
Attached patch v2 (obsolete) — Splinter Review
Okay, further testing with a slightly different configuration proves that this does in fact have significant performance benefits. (My previous tests were with columns like remaining_time, which are always slow.) I can sign off on the Search.pm side of things here, but pyrzak, could you sign off on the UI?
Attachment #513840 - Attachment is obsolete: true
Attachment #513843 - Flags: review?(guy.pyrzak)
Attached image UI for a limited search
Here's a screenshot of what happens when you do a search and it gets limited. The same link appears at the bottom of the list, as well.
Attachment #513843 - Flags: review?(guy.pyrzak) → review+
Comment on attachment 513843 [details] [diff] [review] v2 Sweet, thanks Guy! dkl, do you want to sign off on all the stuff here that isn't in Search.pm?
Attachment #513843 - Flags: review?(dkl)
Comment on attachment 513843 [details] [diff] [review] v2 I feel like we should still return the number of bug found in addition to the new show all link. With the patch, it just show the 500 limit message and for any number of bugs less than 500. People may still like to know how many that was returned. Maybe the following patch would be better: +[% BLOCK num_results %] + <span class="bz_result_count"> + [% IF bugs.size == 0 %] + <span class="zero_results">[% terms.zeroSearchResults %].</span> + [% ELSE %] + [% IF bugs.size == 1 %] + One [% terms.bug %] found. + [% ELSE %] + [% bugs.size %] [%+ terms.bugs %] found. + [% END %] + [% IF default_limited %] + This result was limited to [% Param('default_search_limit') FILTER html %] + [%+ terms.bugs %]. + <a href="buglist.cgi?[% urlquerypart FILTER html %] + [%- "&order=$qorder" FILTER html IF order %]&limit=0">See + all search results for this query</a>. + [% END %] + [% END %] + </span> +[% END %]
Attachment #513843 - Flags: review?(dkl) → review-
Comment on attachment 513843 [details] [diff] [review] v2 (In reply to comment #7) > I feel like we should still return the number of bug found in addition to the > new show all link. Oh, there are only 500 bugs returned, we're doing a LIMIT clause. If we were to add SQL_CALC_FOUND_ROWS, that removes all performance benefits of LIMIT, as MySQL actually goes on to calculate the entire result regardless oflimit.
Attachment #513843 - Flags: review- → review?(dkl)
(In reply to comment #8) > Oh, there are only 500 bugs returned, we're doing a LIMIT clause. If we were > to add SQL_CALC_FOUND_ROWS, that removes all performance benefits of LIMIT, as > MySQL actually goes on to calculate the entire result regardless oflimit. You will still get a lot of user performance boost by not transferring the data... and some boost from mysql because it won't need to sort/process all the data. But not as good as not doing the work at all of course.
Hmm, not sure you understood what I was asking. I was just merely stating to still show bugs.size in the template output on the buglist.cgi page. You shouldn't need to do a call to the DB for that as the template is just displaying the number of entries in the $vars->{bugs} Perl list. Dave
(In reply to comment #9) > You will still get a lot of user performance boost by not transferring the > data... MySQL will still pull every row from the database (although it still does that in many cases anyhow, since we have a GROUP BY). > and some boost from mysql because it won't need to sort/process all the > data. No, bypassing the LIMIT optimization would mean sorting every row: http://dev.mysql.com/doc/refman/5.0/en/limit-optimization.html
(In reply to comment #10) > Hmm, not sure you understood what I was asking. I was just merely stating to > still show bugs.size in the template output on the buglist.cgi page. Oh, bugs.size is 500...or it should be. Oh right, I only check default_limited! I will fix that. Gee. :-)
Attached patch v3Splinter Review
Now we only display the "500" message if there were exactly 500 results.
Attachment #513843 - Attachment is obsolete: true
Attachment #514350 - Flags: review?
Attachment #513843 - Flags: review?(dkl)
Attachment #514350 - Flags: review? → review?(dkl)
Comment on attachment 514350 [details] [diff] [review] v3 Looks good now. I did test the patch but I do not have a database with that many results locally. If your testing on a large amount of results works then r=dkl.
Attachment #514350 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval? → approval+
Sweet, thank you for the review, dkl! :-) Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified buglist.cgi modified Bugzilla/Search.pm modified Bugzilla/Config/Query.pm modified template/en/default/admin/params/query.html.tmpl modified template/en/default/list/list.html.tmpl Committed revision 7734.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 870962
Blocks: 870962
No longer depends on: 870962
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: