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)
1.06 KB,
patch
|
dkl
:
review+
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #615138 -
Flags: review?(mkanat)
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Bugzilla 4.4
Version: unspecified → 4.3
Updated•13 years ago
|
Attachment #615138 -
Attachment is patch: true
Comment 2•13 years ago
|
||
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-
Assignee | ||
Comment 3•13 years ago
|
||
(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)
Comment 4•12 years ago
|
||
Increasing severity as it blocks 4.4rc1.
Updated•12 years ago
|
Attachment #615438 -
Flags: review?(mkanat) → review?(dkl)
Updated•12 years ago
|
Flags: blocking4.4+
Comment 5•12 years ago
|
||
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+
Comment 6•12 years ago
|
||
(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+
Comment 7•12 years ago
|
||
(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
Comment 8•12 years ago
|
||
So I will let you commit this patch, as you reviewed it. ;)
Comment 9•12 years ago
|
||
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
Assignee | ||
Comment 10•12 years ago
|
||
(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.
Description
•