Re: Index isn't used during a join.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When grilled further on (Mon, 9 Jan 2006 22:58:18 -0700),
Michael Fuhr <mike@xxxxxxxx> confessed:

> On Mon, Jan 09, 2006 at 09:23:38PM -0700, Robert Creager wrote:
> > I'm working with a query to get more info out with a join.  The base
> > query works great speed wise because of index usage.  When the join is
> > tossed in, the index is no longer used, so the query performance tanks.
> 
> The first query you posted returns 285 rows and the second returns
> over one million; index usage aside, that difference surely accounts
> for a performance penalty.  And as is often pointed out, index scans
> aren't always faster than sequential scans: the more of a table a
> query has to fetch, the more likely a sequential scan will be faster.

Thanks for pointing out the obvious that I missed.  Too much data in the second query.  It's supposed to match (row wise) what was returned from the first query.

Just ignore me for now...

Thanks,
Rob

-- 
 08:15:24 up 3 days, 42 min,  9 users,  load average: 2.07, 2.20, 2.25
Linux 2.6.12-12-2 #4 SMP Tue Jan 3 19:56:19 MST 2006

Attachment: pgpk7a7lcV7vh.pgp
Description: PGP signature


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux