Re: Understanding explain costs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Link <dlink(at)soundscan(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Understanding explain costs
Date: 2001-10-12 17:41:03
Message-ID: 27379.1002908463@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Link <dlink(at)soundscan(dot)com> writes:
> tiger=# explain select * from bk_inv where isbn = 'foo';
> NOTICE: QUERY PLAN:

> Index Scan using bk_inv_isbn_idx on bk_inv (cost=0.00..53.13
> rows=13 width=48)

> However, however using the store index costs are still rather high -
> why is that!!??

> tiger=# explain select * from bk_inv where store = 'foo';
> NOTICE: QUERY PLAN:

> Index Scan using bk_inv_store_idx on bk_inv (cost=0.00..53456.09
> rows=13488 width=48)

Note the difference in estimated number of rows retrieved; that's where
the cost difference comes from. You may care to read

http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/performance-tips.html

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-10-12 17:41:51 Re: Contents of greatbridge.com?
Previous Message Culley Harrelson 2001-10-12 17:23:52 Re: PG mailing list problems (was Re: Support issues)