Download & Extend

Adding an index to comments table speeds performance of /forum a great deal

Project:Advanced Forum
Version:6.x-2.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

While trying to improve performance of the /forum page, I added this index and shaved over 4 full seconds of db/pageload time on a large comments table (more than 500,000 comments in this case).

ALTER TABLE comments ADD INDEX cid_nid (cid, nid);

Might be worth adding to the install file. I am not sure if its considered hacking core to add an index a core table like this. It does provide quite a performance boost. I would provide a patch but I'm not so good a CVS yet.

Additionally this query: http://drupal.org/node/529180 is slow on a large users table. This query is shared with the "Who's New" block in core so I filed a core issue on this.

Thanks Michelle for a great module!

Comments

#1

Version:6.x-1.1» 6.x-2.x-dev

Well, merlinofchaos thought it was ok when we discussed it on IRC, so that's good enough for me. :) Will need to find out how one adds an index in an install file and then will get it in.

Thanks,

Michelle

#2

Version:6.x-2.x-dev» 6.x-1.1

Something like this should do the trick

db_query("ALTER TABLE {comments} ADD INDEX cid_nid (cid, nid);");

#3

Version:6.x-1.1» 6.x-2.x-dev

Thanks. BTW, I changed the version intentionally. Feature requests go against 2.x. 1.x is all done.

Michelle

#4

Is still a valid issue? I added this index to my db as my forum is also quite slow on the overview page. it did not change too much, but it also did not hurt so far.

#5

The queries on the overview page are very expensive. I haven't tried adding this index, yet. No idea how much good it does.

Michelle

#6

based on my page I can confirm it helps! my typical page load time is now less than 10 sec whereas it has been close to 20 before. so i would reccommend this index as well!

#7

Michelle, I'm also seeing very good results with this tweak. Are there any plans on adding this?

In my opinion there's a lot that can be optimised about forum performance. A lot is core Drupal stuff, but since many serious forums use your module I'd think it would be good if your module helped out on that issue.

#8

@Pixelstyle: Yes, it's still an active feature request. I'm working my way through the bugs first, so haven't gotten to this, yet.

Michelle

nobody click here