Closed (fixed)
Project:
Storm
Version:
6.x-2.x-dev
Component:
Storm.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2012 at 11:46 UTC
Updated:
26 Jan 2012 at 13:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
kfritscheFollowing patch adds indexes for all nid fields.
I'm also thinking to add status/category/priority as indexes, as these are varchars and i think are often used as filter.
Comment #2
kfritscheWhat also worth to be checked, if we are using on every join the nid and the vid or only one of them.
If we only do a JOIN stormproject stp ON (x.projectnid = stp.nid) insted of JOIN stormproject stp ON (x.projectnid = stp.nid AND x.projectvid = stp.vid), we should change the primary key to only nid and add vid as unique key, like the node table does it.
Comment #3
juliangb commentedWe generally join on vid, as this allows revisions to work correctly.
Comment #5
juliangb commentedJust one thing I saw:
$return / $ret mismatch.
Powered by Dreditor.
Comment #6
kfritscheIf storm is using only vid in the joins, we should split the primary key! The current implementation only uses the index, if we do a join with nid AND vid. Thats why this is split in the node table as well.
I will do this in the next patch, and fix the error with the $ret/$return and remove assigned_nid from timetracking, as this column doesn't exists in stormtimetracking...
Comment #7
kfritscheNew Patch with the fixes mentioned in #6.
Comment #8
juliangb commentedOne question that I have - surely by only having nid in each primary key now, we will have primary key violations whenever node revisions are turned on?
And one comment from reading through the code:
No change here, despite the key being split in update storminvoice 6201.
Comment #9
kfritscheUh. You are right. I forgot the node table only stores the current vid.
So vid should be the primary key and nid only a index or we keep the current primary key and add an extra index for vid and an index for nid. The second way sounds a little bit obscure to me, so i would prefere vid as primary key, as this is always unique and keep the nid as an index for all cases.
We should probably check the revisioning with views too.
Comment #10
juliangb commentedYes, I'd agree with vid as primary key and nid as index.
As far as I'm aware, all views fields are set up to join on vid too.
Comment #11
kfritscheViews only uses vid. I only want to be sure.
Changed the PK to vid and all nid's as index. Its now like the node_revision table.
Want we leave it by that or do we want to add more indexes for status/category/priority, because i would be a often used filter and these are var_chars. Whats your opinion on that?
I'm not quite sure how we should handle that. It would do a minimal speed up for the query on the other hand its more overhead, which is maybe only in my case relevant.
At the moment I think at least status, datebegin, dateend will make it into storm_contrib, if we decide to not include this in storm. Because storm_contrib uses this fields in some complex queries and are boosted by the index.
Comment #12
juliangb commentedLooks good from a read through (haven't tested yet).
I'm neutral on the indexes for status/category/priority - it will always help some / hinder others.
Comment #13
juliangb commentedI've applied the patch and tested. All seems good so far.
Comment #14
juliangb commentedCommitted.