Costs: Index vs Non-Index

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Costs: Index vs Non-Index
Date: 2000-01-08 06:58:56
Message-ID: Pine.BSF.4.21.0001080254230.18498-100000@thelab.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hrmmm...if I'm reading this right, its more costly to create an index then
to leave it as a sequential scan, but it returns more rows? Yet, it
returns, if I do the query with a count() around the return value, 288
rows, not 334 or 1154...

udmsearch=> explain select next_index_time from url where next_index_time <= 947317073;
NOTICE: QUERY PLAN:

Seq Scan on url (cost=43.00 rows=334 width=4)

EXPLAIN
udmsearch=> create index url_next_index_time on url using btree ( next_index_time);
CREATE
udmsearch=> explain select next_index_time from url where next_index_time <= 947317073;
NOTICE: QUERY PLAN:

Index Scan using url_next_index_time on url (cost=271.68 rows=1154 width=4)

EXPLAIN

Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy(at)hub(dot)org secondary: scrappy(at){freebsd|postgresql}.org

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ed Loehr 2000-01-08 07:04:38 ERROR: out of free buffers: time to abort !
Previous Message Tom Lane 2000-01-08 06:47:58 Re: [SQL] createdb -D xxxx not working