Re: BUG #4690: an select query is not using the index

Lists: pgsql-bugs
From: "vikas" <vikas(dot)dubey(at)newgen(dot)co(dot)in>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4690: an select query is not using the index
Date: 2009-03-04 10:15:49
Message-ID: 200903041015.n24AFnhk092105@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4690
Logged by: vikas
Email address: vikas(dot)dubey(at)newgen(dot)co(dot)in
PostgreSQL version: PostgreSQL 7.3
Operating system: i686-pc-linux-gnu
Description: an select query is not using the index
Details:

hi

there is a table PDBFolder whose one column is Parentfolderindex on which an
index 'idx_folder_parentfolderindex' is created.

when i execute the following query

Select ParentFolderIndex From PDBFolder Where ParentFolderIndex In (
Select FolderId From FolderTree Where Leaf = 1::int4 )

it takes approximately 10 minutes and when i see the query execution plan of
this query it shows sequence scan on pdbfolder(which contain 50,000 rows).
can you suggest there is any way to use index idx_folder_parentfolderindex
in above query

regards
Vikas Dubey


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: vikas <vikas(dot)dubey(at)newgen(dot)co(dot)in>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4690: an select query is not using the index
Date: 2009-03-04 10:51:05
Message-ID: 49AE5D19.60206@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

vikas wrote:
> The following bug has been logged online:
>
> Bug reference: 4690
> Logged by: vikas
> Email address: vikas(dot)dubey(at)newgen(dot)co(dot)in
> PostgreSQL version: PostgreSQL 7.3

Time to upgrade.

> Operating system: i686-pc-linux-gnu
> Description: an select query is not using the index
> Details:
>
> hi
>
> there is a table PDBFolder whose one column is Parentfolderindex on which an
> index 'idx_folder_parentfolderindex' is created.

More details please.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: vikas <vikas(dot)dubey(at)newgen(dot)co(dot)in>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4690: an select query is not using the index
Date: 2009-03-04 16:49:17
Message-ID: 3212.1236185357@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> vikas wrote:
>> PostgreSQL version: PostgreSQL 7.3

> Time to upgrade.

Indeed. 7.4 was the first release that had even an inkling of how to
optimize IN (sub-SELECT) clauses.

regards, tom lane