Fwd: [GENERAL] index not scanned - Mailing list pgsql-hackers

From Mario Weilguni
Subject Fwd: [GENERAL] index not scanned
Date
Msg-id 200210271205.54726.mweilguni@sime.com
Whole thread Raw
List pgsql-hackers
The topic below is quite common on the general list, people tend to ask without checking the documentation. I think
mostof those questions will 
disappear if the planner output is modified, so it is clear why a decision is made (maybe with an extra option).

e.g. something like this if an index scan is possible but not used:

EXPLAIN SELECT * FROM copy_of_forum_list_child WHERE f_id = 1 and
father_name = 'top';
Seq Scan on copy_of_forum_list_child  (cost=0.00..2.44 rows=1width=100, costs using index: 0.00...9.44 rows=...
with=...)

Any comments?

Regards,Mario Weilguni


----------  Weitergeleitete Nachricht  ----------

Subject: [GENERAL] index not scanned
Date: Sun, 27 Oct 2002 12:46:39 +0200
From: "Ben-Nes Michael" <miki@canaan.co.il>
To: "postgresql" <pgsql-general@postgresql.org>

Hi

I add an Index to table that have only 30 rows.

CREATE INDEX copy_of_forum_l_c_f_id_idx ON copy_of_forum_list_child ( f_id,
father_name );

when i do:
EXPLAIN SELECT * FROM copy_of_forum_list_child WHERE f_id = 1 and
father_name = 'top';

its return: Seq Scan on copy_of_forum_list_child  (cost=0.00..2.44 rows=1
width=100)

why its not scanning the index ?

does the planner knows that the table is small and it will take more time to
check the index then stright check ?

by the way, the table will get quite big in the future.

Cheers


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command   (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

-------------------------------------------------------



pgsql-hackers by date:

Previous
From: "Jesus M. Milan-Franco"
Date:
Subject: Help compiling postgres
Next
From: Larry Rosenman
Date:
Subject: Re: assignment type mismatch complaints