why am I getting a seq scan on this query?

From: Mark Harrison <mh(at)pixar(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: why am I getting a seq scan on this query?
Date: 2006-01-06 21:09:37
Message-ID: 43BEDC91.7000704@pixar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm expecting this to do an indexed scan... any clue why it's not? This is
with PG 7.4.

Thanks!!

planb=# explain select id,shotname from df_files where showid=30014515::bigint;
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on df_files (cost=0.00..791035.45 rows=540370 width=22)
Filter: (showid = 30014515::bigint)
(2 rows)

planb=# \d df_files;
Table "public.df_files"
Column | Type | Modifiers
-----------+-----------------------------+-----------
id | bigint | not null
showid | bigint | not null
shotname | character varying(256) | not null
elemname | character varying(256) | not null
frameno | character varying(12) | not null
ext | character varying(12) | not null
filename | character varying(256) | not null
filesize | bigint |
locked | boolean |
timestamp | timestamp without time zone |
Indexes:
"df_files_pkey" primary key, btree (id)
"df_files_elemname" btree (elemname)
"df_files_ext" btree (ext)
"df_files_filename" btree (filename)
"df_files_frameno" btree (frameno)
"df_files_shotname" btree (shotname)
"df_files_show" btree (showid)
"df_files_showid" btree (showid)

planb=# select count(*) from df_files where showid=30014515::bigint;
count
--------
528362
(1 row)

Time: 420598.071 ms
planb=# select count(*) from df_files;
count
----------
24415513
(1 row)

Time: 306554.085 ms

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-01-06 21:13:58 Re: why am I getting a seq scan on this query?
Previous Message Tom Lane 2006-01-06 20:56:57 Re: Reordering columns in a table