[Zope-DB] SQL optimisation

Matthew T. Kromer matt@zope.com
Fri, 01 Nov 2002 10:47:19 -0500

Charlie Clark wrote:

>Dear list,
>I need some help with an SQL-query which seems to be running a lot slower 
>than it should be. The query uses some <dtml-if>s depending on the form 
>which I find quite useful but seems to get slower the more constraints 
>(maybe the wrong word here) I set. It didn't use to.
>[... complex query omitted ...]
>I'm obviously dangerously close to "SQL-optmisation" stuff which shouldn't 
>actually be necessary for this application.
>Thanx for any pointers to subtle mistakes.

Can you give me a hint what database you are using?  For Oracle, you can 
turn on the query analyzer and see what it is doing.  If you were using 
Oracle and you weren't using the cost based analyzer (but were using the 
older predictive optimizer instead, because your DBA hadn't turned on 
the necessary stuff for the newer analyzer) it can make a *huge* 
difference in how your data comes back.

Matt Kromer
Zope Corporation  http://www.zope.com/