Re: Index isn't used during a join.

From: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: PGPerformance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index isn't used during a join.
Date: 2006-01-10 15:17:05
Message-ID: 20060110081705.221792f9@thunder.logicalchaos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

When grilled further on (Mon, 9 Jan 2006 22:58:18 -0700),
Michael Fuhr <mike(at)fuhr(dot)org> 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-01-10 15:22:59 Re: 500x speed-down: Wrong statistics!
Previous Message Greg Stark 2006-01-10 15:11:18 Re: NOT LIKE much faster than LIKE?