Closed Bug 745533 Opened 13 years ago Closed 12 years ago

database add index audit_log_class_at_time_idx for audit_log

Categories

(Bugzilla :: Database, defect, P1)

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: Frank, Assigned: Frank)

References

Details

Attachments

(1 file, 1 obsolete file)

follow up of Bug#740536: (In reply to Frédéric Buclin from comment #25) > (In reply to Max Kanat-Alexander from comment #24) > > BTW, you're going to need an index on the class field now. Otherwise your > > DB servers are going to be in a world of pain when people start to use this > > API. > > dkl or Frank: please file a bug for the DB index.
Attached patch patch V1 (obsolete) — Splinter Review
Attachment #615138 - Flags: review?(mkanat)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Bugzilla 4.4
Version: unspecified → 4.3
Attachment #615138 - Attachment is patch: true
Comment on attachment 615138 [details] [diff] [review] patch V1 Review of attachment 615138 [details] [diff] [review]: ----------------------------------------------------------------- ::: Bugzilla/DB/Schema.pm @@ +506,5 @@ > added => {TYPE => 'MEDIUMTEXT'}, > at_time => {TYPE => 'DATETIME', NOTNULL => 1}, > ], > + INDEXES => [ > + audit_log_class_at_time_idx => ['class', 'at_time'], Indexes need to be named by their first field only. So this would be audit_log_class_idx. Also, why do you need at_time in this index? That's going to make it much larger.
Attachment #615138 - Flags: review?(mkanat) → review-
Attached patch patch V2Splinter Review
(In reply to Max Kanat-Alexander from comment #2) > Comment on attachment 615138 [details] [diff] [review] > patch V1 > > Review of attachment 615138 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: Bugzilla/DB/Schema.pm > @@ +506,5 @@ > > added => {TYPE => 'MEDIUMTEXT'}, > > at_time => {TYPE => 'DATETIME', NOTNULL => 1}, > > ], > > + INDEXES => [ > > + audit_log_class_at_time_idx => ['class', 'at_time'], > > Indexes need to be named by their first field only. So this would be > audit_log_class_idx. Also, why do you need at_time in this index? That's > going to make it much larger. I add the at_time to the index so that we can get the max only by access to the index. Otherwise you end with on entry in the index for every class and this entry has a long rid list. With the two columns we have 8 bytes more per entry but the database engine can pick the first/last entry that matches the class value. BTW maybe we need to add an descending to make sure that the max is the first entry.
Attachment #615138 - Attachment is obsolete: true
Attachment #615438 - Flags: review?(mkanat)
Increasing severity as it blocks 4.4rc1.
Assignee: database → Frank
Severity: normal → major
Depends on: 740536
Priority: -- → P1
Attachment #615438 - Flags: review?(mkanat) → review?(dkl)
Flags: blocking4.4+
Comment on attachment 615438 [details] [diff] [review] patch V2 Review of attachment 615438 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. r=dkl ::: Bugzilla/DB/Schema.pm @@ +506,5 @@ > added => {TYPE => 'MEDIUMTEXT'}, > at_time => {TYPE => 'DATETIME', NOTNULL => 1}, > ], > + INDEXES => [ > + audit_log_class_idx => ['class', 'at_time'], nit: fix indentation on checkin
Attachment #615438 - Flags: review?(dkl) → review+
(In reply to David Lawrence [:dkl] from comment #5) > Looks good. r=dkl I hope it's more than just a "looks good". :) We cannot afford checksetup.pl to fail or corrupt the DB when upgrading the schema. Make sure this patch has been tested before checking in.
Status: NEW → ASSIGNED
Flags: approval+
(In reply to Frédéric Buclin from comment #6) > (In reply to David Lawrence [:dkl] from comment #5) > > Looks good. r=dkl > > I hope it's more than just a "looks good". :) We cannot afford checksetup.pl > to fail or corrupt the DB when upgrading the schema. Make sure this patch > has been tested before checking in. Yes, Admittedly I should have been more specific than 'looks good' ;) But I do normally test a patch before r+ and in this case I did the following verifications: 1. Install new db from scratch and observed the index was created properly. 2. Upgraded a previous test database that did not yet have the index and observed the new index was created properly. 3. Ran several queries using the class column and 'explain' to see that the index was indeed being used. Everything tested fine. I assume the patch author has tested it locally as well. dkl
So I will let you commit this patch, as you reviewed it. ;)
trunk: Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk modified Bugzilla/Install/DB.pm modified Bugzilla/DB/Schema.pm Committed revision 8260.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
(In reply to David Lawrence [:dkl] from comment #7) > (In reply to Frédéric Buclin from comment #6) > > (In reply to David Lawrence [:dkl] from comment #5) > > > Looks good. r=dkl > > > > I hope it's more than just a "looks good". :) We cannot afford checksetup.pl > > to fail or corrupt the DB when upgrading the schema. Make sure this patch > > has been tested before checking in. > > Yes, Admittedly I should have been more specific than 'looks good' ;) But I > do normally test a patch before r+ and in this case I did the following > verifications: > > 1. Install new db from scratch and observed the index was created properly. > 2. Upgraded a previous test database that did not yet have the index and > observed the new index was created properly. > 3. Ran several queries using the class column and 'explain' to see that the > index was indeed being used. > > Everything tested fine. I assume the patch author has tested it locally as > well. Yes, I did the some tests (1. and 2.), but did not use explain > > dkl
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: