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.

CommentFileSizeAuthor
#5 faq_5x_309474.patch2.66 KBstella
#5 faq_6x_309474.patch3.24 KBstella

Comments

nancydru’s picture

That's a reasonable solution. I use it in several of my modules for that very reason.

alexanderpas’s picture

please create a patch.

Zurvan’s picture

Silly question: How do I create a patch?

alexanderpas’s picture

stella’s picture

Status: Active » Fixed
StatusFileSize
new3.24 KB
new2.66 KB

sorry 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

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

stella’s picture

Released in 5.x-2.12 and 6.x-1.8.