Planner statistics vs. count(*) - Mailing list pgsql-performance

From evgeny gridasov
Subject Planner statistics vs. count(*)
Date
Msg-id 20050920221255.2c32b87b.eugrid@fpm.kubsu.ru
Whole thread Raw
In response to Re: RAID Stripe size  (evgeny gridasov <eugrid@fpm.kubsu.ru>)
Responses Re: Planner statistics vs. count(*)
List pgsql-performance
Hi Everybody.

I am going to replace some 'select count(*) from ... where ...' queries
which run on large tables (10M+ rows) with something like
'explain select * from ... where ....' and parse planner output after that
to find out its forecast about number of rows the query is going to retrieve.

Since my users do not need exact row count for large tables, this will
boost performance for my application. I ran some queries with explain and
explain analyze then. If i set statistics number for the table about 200-300
the planner forecast seems to be working very fine.

My questions are:
1. Is there a way to interact with postgresql planner, other than 'explain ...'? An aggregate query like 'select
estimate_count(*)from ...' would really help =)) 
2. How precise is the planner row count forecast given for a complex query (select with 3-5 joint
tables,aggregates,subselects,etc...)? 


--
Evgeny Gridasov
Software Developer
I-Free, Russia

pgsql-performance by date:

Previous
From: evgeny gridasov
Date:
Subject: Re: RAID Stripe size
Next
From: Bricklen Anderson
Date:
Subject: Re: Planner statistics vs. count(*)