Closed Bug 713144 Opened 13 years ago Closed 13 years ago

The SQL query to remove older searches from the profile_search table should be more robust

Categories

(Bugzilla :: Query/Bug List, defect)

4.0.2
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

(Keywords: perf)

Attachments

(1 file)

Attached patch patch, v1Splinter Review
For some unknown reasons, it may happen that the profile_search table stores more than SAVE_NUM_SEARCHES (default 10) recent searches per user. For instance, bmo stores 5532 buglists for me, and 207422 for dsicore! This makes viewing a bug slower, because Bugzilla scans them all to see which buglist to use for the Prev/Next navigation links. We should improve the SQL query to really delete older queries.
Attachment #583958 - Flags: review?(justdave)
Severity: normal → minor
For comparison, here's what I actually ran on the database server to clean out the overages: # mysql --skip-column-names -B -e 'select concat("DELETE FROM profile_search WHERE user_id=", search_counts.user_id, " AND id <= ", (select id from profile_search where user_id=search_counts.user_id order by id desc limit 10,1), ";") from (select user_id, count(id) as num from profile_search group by user_id) as search_counts where num > 10;' bugs | mysql bugs
ouch.
Comment on attachment 583958 [details] [diff] [review] patch, v1 Asking glob too as I saw that justdave was away till Dec 27.
Attachment #583958 - Flags: review?(glob)
Attachment #583958 - Flags: review?(glob) → review?(dkl)
Comment on attachment 583958 [details] [diff] [review] patch, v1 Review of attachment 583958 [details] [diff] [review]: ----------------------------------------------------------------- Looks good and works as expected. r=dkl
Attachment #583958 - Flags: review?(dkl) → review+
Attachment #583958 - Flags: review?(justdave)
Flags: approval4.2+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Search/Recent.pm Committed revision 8051. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/ modified Bugzilla/Search/Recent.pm Committed revision 7987.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: