I'm working on tuning some SQL in a Sybase DB and have found a number of queries which don't seem to be utilizing the indexes efficiently on the DB tables. It seems to me that in a join statement, the most logical order for the WHERE statments would be an order which first checks fields that are indexed on each table. For example:
FROM table1 a,
WHERE a.indexed_column1 = :hstvariable1
AND a.indexed_column2 = :hstvariable2
AND b.indexed_column1 = a.indexed_column1
AND b.unindexed_column1 = :hstvariable3
(I hope that this is making sense.) In other words, can reordering the WHERE conditions help performance by eliminating some reads on the tables?