Re: Understanding explain costs

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

Tom Lane wrote:
>
> 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 numbe.r 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

Yes I read that Tom, thanks. It seems to be the only thing out there on
performance tuning for Postgres that I have been able to find.

Thanks for the explaination. That makes sense. There are far fewer
unique isbns then there are vendors in my table.

--David

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-10-12 19:09:02 Re: Vacuum analyze with 7 millions records ... takes 1
Previous Message Nathan Clemons 2001-10-12 19:01:12 Re: COMMIT after an ERROR?