Re: Slow query performance on large table - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow query performance on large table
Date
Msg-id 27569.1046800393@sss.pgh.pa.us
Whole thread Raw
In response to Re: Slow query performance on large table  (Andreas Pflug <Andreas.Pflug@web.de>)
List pgsql-performance
Andreas Pflug <Andreas.Pflug@web.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

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: PostgreSQL Performance Issue on Mail Server
Next
From: Andreas Pflug
Date:
Subject: Re: Slow query performance on large table