I noticed an gigantic performance penalty on using an {if} tag in a {exp:query} tags when the query returns a lot of rows (>2000).
This code takes approx. 30secs. on our server:
{exp:query sql="..."}
{if total_results==0}
...
{/if}
...
<a href="/tag/channel/{tag_name}/{segment_3}">{tag_name} ({num})</a><br>
...
{/exp:query}This code takes approx. 3 secs.
{exp:query sql="..."}
...
<a href="/tag/channel/{tag_name}/{segment_3}">{tag_name} ({num})</a><br>
...
{/exp:query}This is the page in question:
http://zaplog.nl/user/tag/ZapLog/ (without {if} -> 21 queries in 0.5430 s.)
And here with the {if}
http://zaplog.nl/user/tagg/ZapLog/ (with {if}, exactly the same chache-settings -> 23 queries in 33.9395 s.)
Also, with this particular {if}-statement the page-caching will NOT work. Without the statement it does. Page loads in <0.5secs now instead of teh previous 30+ secs. 😊
The query itself is very extensive but never takes >3 secs. when tested using a MySQL front-end.