Re: why sequential scan is used on indexed column ???

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: why sequential scan is used on indexed column ???
Date: 2008-06-15 07:12:28
Message-ID: 20080615071228.GA7695@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Fuhr <mike(at)fuhr(dot)org> schrieb:

> On Sat, Jun 14, 2008 at 04:59:44PM +0200, Andreas Kretschmer wrote:
> > Julius Tuskenis <julius(dot)tuskenis(at)gmail(dot)com> schrieb:
> > > I have a question concerning performance. One of my queries take a long
> > > to execute. I tried to do "explain analyse" and I see that the
> > > sequential scan is being used, although I have indexes set on columns
> > > that are used in joins. The question is - WHY, and how to change that
> > > behavior???
> >
> > Try to create an index on apsilankymai.sas_id
>
> In the DDL that Julius posted apsilankymai doesn't have an sas_id
> column.
>
> The join is on apsilankymai.aps_saskaita = b_saskaita.sas_id. Both
> columns have an index: b_saskaita.sas_id is a primary key so it
> should have an index implicitly, and apsilankymai.aps_saskaita has

Right, my mistake.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-general by date

  From Date Subject
Next Message 加入简历库,让好工作找到你 2008-06-15 10:24:27 加入简历库,让好工作找到你
Previous Message D. Dante Lorenso 2008-06-15 05:01:29 Need Tool to sync databases with 8.3.1