I was experiencing an excessive number of database queries while developing my site. I'd added a number of modules, including FAQ & FAQ_ASK, without checking performance.
I finally tracked down that this query:
SELECT v.vid, v.*, n.type FROM vocabulary v LEFT JOIN vocabulary_node_types n ON v.vid = n.vid WHERE n.type = 'faq' ORDER BY v.weight, v.name
was running 10 times per page load when FAQ was enabled. I tracked this down to line 1399 of the faq.module, where it calls taxonomy_get_vocabularies('faq') for each link in some blocks. In my playing around, I was able to resolve the issue by setting $vocabularies as a static, and only running the query if it was unset, which then causes the query to be called once only. However, I'm not sure if this is an acceptable solution, since I don't know the system very well, or what implications this could have. It was a proof of concept more than anything.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | faq_5x_309474.patch | 2.66 KB | stella |
| #5 | faq_6x_309474.patch | 3.24 KB | stella |
Comments
Comment #1
nancydruThat's a reasonable solution. I use it in several of my modules for that very reason.
Comment #2
alexanderpas commentedplease create a patch.
Comment #3
Zurvan commentedSilly question: How do I create a patch?
Comment #4
alexanderpas commentedhttp://drupal.org/patch/create
Comment #5
stella commentedsorry for the delay in getting to this issue. I've committed a patch for this, so you can either use the latest dev release (available later today) or one of the attached patches.
Cheers,
Stella
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
stella commentedReleased in 5.x-2.12 and 6.x-1.8.