Fwd: [GENERAL] index not scanned

From: Mario Weilguni <mweilguni(at)sime(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fwd: [GENERAL] index not scanned
Date: 2002-10-27 11:05:54
Message-ID: 200210271205.54726.mweilguni@sime.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The topic below is quite common on the general list, people tend to ask without checking the documentation. I think most of 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(at)canaan(dot)co(dot)il>
To: "postgresql" <pgsql-general(at)postgresql(dot)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(at)postgresql(dot)org)

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2002-10-27 13:46:24 Re: assignment type mismatch complaints
Previous Message Jesus M. Milan-Franco 2002-10-27 08:43:05 Help compiling postgres