Closed
Bug 449086
Opened 16 years ago
Closed 16 years ago
Create temporary tables for frequently used places tables
Categories
(Toolkit :: Places, defect, P1)
Toolkit
Places
Tracking
()
RESOLVED
FIXED
mozilla1.9.1b2
People
(Reporter: sdwilsh, Assigned: sdwilsh)
References
Details
Attachments
(1 file, 10 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
And views with triggers to help manage some of the complexity (but not all of it because that hurts perf!).
Assignee | ||
Comment 1•16 years ago
|
||
Strictly additive changes to add all the needed tables, views, and triggers. No logic changes here, and all tests still pass.
Assignee | ||
Comment 2•16 years ago
|
||
See http://shawnwilsher.com/archives/170 for the reasoning behind this change.
Attachment #332290 -
Attachment is obsolete: true
Assignee | ||
Comment 3•16 years ago
|
||
This is all set and ready to go now.
Attachment #332472 -
Attachment is obsolete: true
Attachment #333130 -
Flags: review?(dietrich)
Assignee | ||
Updated•16 years ago
|
Whiteboard: [has patch][needs review dietrich]
Assignee | ||
Comment 4•16 years ago
|
||
There was a bug in the insert trigger for moz_historyvisits_view.
Attachment #333130 -
Attachment is obsolete: true
Attachment #333235 -
Flags: review?(dietrich)
Attachment #333130 -
Flags: review?(dietrich)
Comment 5•16 years ago
|
||
Comment on attachment 333235 [details] [diff] [review]
v1.1
i don't understand the selective segregation of SQL from code. tables and triggers are kept in separate header files, but indexes and views aren't? this is not intuitive. i think indexes should be stored w/ the tables they index. views are like virtual tables, so maybe views and their indexes should be kept w/ the tables as well.
Assignee | ||
Comment 6•16 years ago
|
||
I think you are right (and I've had that very idea myself). I just haven't prioritized it since I can't get most of the unit tests to pass yet.
Assignee | ||
Comment 7•16 years ago
|
||
A few more issues cropped up. I'm fairly certain that things are working as expected now with regards to the triggers.
Attachment #333235 -
Attachment is obsolete: true
Attachment #333235 -
Flags: review?(dietrich)
Assignee | ||
Comment 8•16 years ago
|
||
If someone else wants to take on that refactoring, that'd be awesome. It's low priority for me until I get these unit tests passing.
Whiteboard: [has patch][needs review dietrich] → [has patch][needs refactoring]
Assignee | ||
Comment 9•16 years ago
|
||
Fixed a few more issues with the triggers.
Attachment #333307 -
Attachment is obsolete: true
Assignee | ||
Comment 10•16 years ago
|
||
Moving the indicies I'm going to punt to bug 450516 since I really want to make sure this stuff lands in a2, and that's not terribly important.
Addresses your other comments.
Attachment #333348 -
Attachment is obsolete: true
Attachment #333667 -
Flags: review?(dietrich)
Assignee | ||
Updated•16 years ago
|
Whiteboard: [has patch][needs refactoring] → [has patch][needs review dietrich]
Assignee | ||
Comment 11•16 years ago
|
||
Last change, really. I swear!
This fixes the visit_count modification bits for the moz_historyvisits_view triggers. They were not filtering on visit_type, which just so happens to cause some test failures.
Attachment #333667 -
Attachment is obsolete: true
Attachment #333882 -
Flags: review?(dietrich)
Attachment #333667 -
Flags: review?(dietrich)
Comment 12•16 years ago
|
||
Comment on attachment 333882 [details] [diff] [review]
v1.5
>+nsresult
>+nsNavHistory::InitTempTables()
>+{
>+ nsresult rv;
>+
>+ // moz_places_temp
>+ rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_PLACES_TEMP);
>+ NS_ENSURE_SUCCESS(rv, rv);
nit: declare rv inline w/ first-use
>+nsresult
>+nsNavHistory::InitViews()
>+{
>+ nsresult rv;
>+
>+ // moz_places_view
>+ rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_PLACES_VIEW);
>+ NS_ENSURE_SUCCESS(rv, rv);
ditto
r=me
Attachment #333882 -
Flags: review?(dietrich) → review+
Comment 13•16 years ago
|
||
-#define CREATE_MOZ_PLACES NS_LITERAL_CSTRING( \
- "CREATE TABLE moz_places ( " \
+#define CREATE_MOZ_PLACES_BASE(__name) NS_LITERAL_CSTRING( \
+ "CREATE TABLE " __name " ( " \
" id INTEGER PRIMARY KEY" \
", url LONGVARCHAR" \
", title LONGVARCHAR" \
", rev_host LONGVARCHAR" \
", visit_count INTEGER DEFAULT 0" \
", hidden INTEGER DEFAULT 0 NOT NULL" \
", typed INTEGER DEFAULT 0 NOT NULL" \
", favicon_id INTEGER" \
", frecency INTEGER DEFAULT -1 NOT NULL" \
")" \
)
maybe i'm crazy or blind, but should not moz_places_temp (and historyvisits_temp) be CREATE (TEMP|TEMPORARY) TABLE?
Assignee | ||
Comment 14•16 years ago
|
||
(In reply to comment #13)
> maybe i'm crazy or blind, but should not moz_places_temp (and
> historyvisits_temp) be CREATE (TEMP|TEMPORARY) TABLE?
Uh...yeah. I'll get that fixed today.
Whiteboard: [has patch][needs review dietrich] → [needs new patch]
Assignee | ||
Comment 15•16 years ago
|
||
fixes the temp issue. I can't believe we managed to miss that. Tests still pass.
Attachment #333882 -
Attachment is obsolete: true
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs new patch] → [has patch][has review][can land]
Assignee | ||
Comment 16•16 years ago
|
||
Marco and I found a bug in the insertion triggers. Four lines changed. Updated the patch locally.
Comment 17•16 years ago
|
||
about that wrong insert trigger yesterday we were talking about doing IFNULL(MAX(id), 1), well the correct instead should be IFNULL(MAX(id), 0) because after that we do +1. So instead of having moz_places starting from 1 we would have it starting from 2, it would still work but better fixing it.
Comment 18•16 years ago
|
||
Comment on attachment 334305 [details] [diff] [review]
v1.6
patch obsololete cause bogus
Attachment #334305 -
Attachment is obsolete: true
Updated•16 years ago
|
Whiteboard: [has patch][has review][can land] → [needs new patch]
Comment 19•16 years ago
|
||
Version with fixed triggers
Updated•16 years ago
|
Whiteboard: [needs new patch] → [has patch][has review]
Assignee | ||
Comment 20•16 years ago
|
||
(In reply to comment #17)
> about that wrong insert trigger yesterday we were talking about doing
> IFNULL(MAX(id), 1), well the correct instead should be IFNULL(MAX(id), 0)
> because after that we do +1. So instead of having moz_places starting from 1 we
> would have it starting from 2, it would still work but better fixing it.
I do believe we talked about doing it with zero, because that's what I have in my version of the patch.
Comment 21•16 years ago
|
||
this changes the insert and delete triggers to update both tables instead of the view. greatly speeds up inserting and removing visits. Could help with hangs.
Shawn: if this is ok for you plase obsolete the previous, i'm not doing it until you review the change
Attachment #339426 -
Flags: review?(sdwilsh)
Comment 22•16 years ago
|
||
see https://bugzilla.mozilla.org/show_bug.cgi?id=450705#c40 for reasoning
Comment 23•16 years ago
|
||
mh, oh wait this could again increase fsync on every visit insert if we have the place on disk, we need a better strategy probably :\
Updated•16 years ago
|
Attachment #339426 -
Attachment is obsolete: true
Attachment #339426 -
Flags: review?(sdwilsh)
Comment 24•16 years ago
|
||
well, we could do that for delete since we are doing a delete from moz_historyvisits that will most likely do an fsync
Assignee | ||
Comment 25•16 years ago
|
||
We could nest the update triggers fully and it would solve the problem, right? To keep our sanity, I'd say do this with a #define value for the trigger body so we can just use the same sql in both places (and then are less likely to make a change in only one spot down the line breaking things).
I think we should do this in a new bug for our own sanity (and it'll be easier to review the change).
Comment 26•16 years ago
|
||
bug 456029 has a patch that applies UPON v1.7 patch, discussion will continue there
Assignee | ||
Comment 27•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Whiteboard: [has patch][has review]
Target Milestone: mozilla1.9.1a2 → mozilla1.9.1b2
You need to log in
before you can comment on or make changes to this bug.
Description
•