From: | Najm Hashmi <najm(at)mondo-live(dot)com> |
---|---|
To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | About Index |
Date: | 2001-01-03 21:05:17 |
Message-ID: | 3A53940D.9F214C69@mondo-live.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
I have created a table songs as follwoing:
CREATE TABLE songs (
song_id serial NOT NULL,
title character varying(50) NOT NULL,
composer varchar(50),
performer varchar(50),
artist_id int4 not null,
file_size int4,
description text,
extrInfo text,
highmd5 text,
lowmd5 text,
PRIMARY KEY (song_id),
constraint fk_songs_art foreign key( artist_id) references artist
);
I also created an other index on attribute title as:
create unique index title_idx on songs(title);
Then I vacuum analyzed my data base.
On command line I type :
explain select title from songs where song_id between 1 and 15 order by
song_id;
NOTICE: QUERY PLAN:
Sort (cost=1.70..1.70 rows=14 width=16)
-> Seq Scan on songs (cost=0.00..1.44 rows=14 width=16)
EXPLAIN
One thing I don't uderstand why query planer is using a seq scan on my
table.
Why it is not using indexing defined. Thank you all for all your help.
Regards.
Najm
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-01-03 22:25:05 | Re: sql99 / sql3 |
Previous Message | Tom Lane | 2001-01-03 20:36:49 | Re: [SQL] Numeric and money |