Re: [SQL] (Mis)using the PostgreSQL planner to get estimated row counts

2005-05-31 Thread Tom Lane
Nick Johnson [EMAIL PROTECTED] writes: I'm trying to write a PostgreSQL extension to estimate the number of rows returned by a SELECT statement. Instead of fooling around at the C level, why don't you just do an EXPLAIN and parse out the first row of the result? For instance regression=#

[SQL] (Mis)using the PostgreSQL planner to get estimated row counts

2005-05-31 Thread Nick Johnson
I'm trying to write a PostgreSQL extension to estimate the number of rows returned by a SELECT statement. Ideally, it'd be invoked along the lines of SELECT estimate_row_count('SELECT foo FROM bar INNER JOIN baz ON (id) WHERE a=b');, and would be useful for estimating the number of pages in a

[SQL] (Mis)using the PostgreSQL planner to get estimated row counts

2005-05-30 Thread Nick Johnson
I'm trying to write a PostgreSQL extension to estimate the number of rows returned by a SELECT statement. Ideally, it'd be invoked along the lines of SELECT estimate_row_count('SELECT foo FROM bar INNER JOIN baz ON (id) WHERE a=b');, and would be useful for estimating the number of pages