From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Slow query performance on large table |
Date: | 2003-03-04 17:53:13 |
Message-ID: | 27569.1046800393@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de> writes:
> "create index ind_meas on measurement (assessment,time)" should perform
> the same as "... primary key(assessment,time)".
Sure.
> Do possibly non-optimal indices (only assessment, only time as Paul
> described earlier) screw up the optimizer, igoring the better option
> usiing the PK?
One would like to think the optimizer will make the right choice. But
using a two-column index just because it's there isn't necessarily the
right choice. The two-column index will certainly be bulkier and more
expensive to scan, so if there's a one-column index that's nearly as
selective, it might be a better choice.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Pflug | 2003-03-04 21:45:36 | Re: Slow query performance on large table |
Previous Message | Tomasz Myrta | 2003-03-04 17:29:30 | Re: Slow query performance on large table |