Re: [PERFORM] Index Selection: ORDER BY vs. PRIMARY KEY

2005-09-19 Thread Thomas F. O'Connell
On Sep 19, 2005, at 10:05 PM, Tom Lane wrote: "Thomas F. O'Connell" <[EMAIL PROTECTED]> writes: Clearly, if the index on the timestamp field is there, postgres wants to use it for the ORDER BY, even though the performance is worse. How is this preference made internally? If both indexes exist

Re: [PERFORM] Index Selection: ORDER BY vs. PRIMARY KEY

2005-09-19 Thread Tom Lane
"Thomas F. O'Connell" <[EMAIL PROTECTED]> writes: > Clearly, if the index on the timestamp field is there, postgres wants > to use it for the ORDER BY, even though the performance is worse. How > is this preference made internally? If both indexes exist, will > postgres always prefer the inde

[PERFORM] Index Selection: ORDER BY vs. PRIMARY KEY

2005-09-19 Thread Thomas F. O'Connell
I have a query that looks roughly like this (I've removed irrelevant SELECT clause material and obfuscated names, trying to keep them consistent where altered in EXPLAIN output): SELECT u.emma_member_id, h.action_ts FROM user as u, history as h WHERE u.user_id = h.user_id AND h.action_id = '$