Re: seq scan instead of index scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: Karl Larsson <karl(dot)larsson47(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: seq scan instead of index scan
Date: 2009-12-18 06:27:11
Message-ID: 29683.1261117631@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Greg Smith <greg(at)2ndquadrant(dot)com> writes:
> Karl Larsson wrote:
>> When I make a subquery Postgres don't care about my indexes and makes
>> a seq scan instead of a index scan. Why?

> Data set is just too small for it to matter. Watch what happens if I
> continue from what you posted with much bigger tables:
> ...
> There's the index scan on both tables that you were expecting.

And if you go much past that, it's likely to switch *away* from
indexscans again (eg, to a hash join, which has no use for ordered
input). This is not wrong. Indexes have their place but they are not
the solution for every query.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Sigurgeir Gunnarsson 2009-12-18 12:46:37 Re: Issues with \copy from file
Previous Message Craig Ringer 2009-12-18 02:20:14 Re: Automatic optimization of IN clauses via INNER JOIN