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