RB Smissaert <[EMAIL PROTECTED]>
wrote:
So, basically it is best to make one large index (apart from the
primary
integer key?) that includes all fields that could be in a WHERE
clause or a
JOIN or a GROUP BY or a HAVING or an ORDER BY?

That depends on the queries you want to speed up. Index columns can only be used from left to right, with no skips, to satisfy the conditions of the query. For example, if you have an index on columns (a, b, c) and a query like

select * from t where a='x' and c='z';

then the index can be used to satisfy a='x' condition, but then a linear check of all records having a='x' is performed to satisfy c='z'. If you run such a query often and need it to run fast, you may want another index on (a, c), or perhaps (a, c, b).

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to