> Then... As a best practice(?) start by assuming that you're 
> DB will process your where clauses from the bottom up and 
> help the system out. If you're lucky enough to have the best 
> stuff out there, like Oracle, which I assume atleast 85%, 
> probably more, don't have then just code completely free of 
> any form knowing that your DB will make up for it.
> 
> If Oracle is optimizing now, then I bet MS SQL server is 
> right on there heels and either doing it too, or have it 
> planned in some service pack. That still leaves Access, 
> PostgreSQL and mySQL. I bet they'd like the help of a well 
> planned SQL statement.

As a best practice, learn the behavior of your database platform. As a best
practice, don't make unwarranted assumptions. Remember that SQL doesn't
specify differences in ordering behavior, and that these details will
certainly be platform-specific.

Most database platforms allow you to test this sort of thing pretty easily.
Both SQL Server and Oracle, for example, allow you to view database plan
information, so it's pretty easy to test a query with different orderings
and see what happens. I've heard that SQL Server will be able to build the
optimal plan if you have up to four conditions (and perhaps more) within a
WHERE clause, but don't take my word for it.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to