Skip site navigation (1) Skip section navigation (2)

Re: empty table explain...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Luca Ferrari <fluca1978(at)infinito(dot)it>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: empty table explain...
Date: 2008-10-27 20:01:49
Message-ID: 23680.1225137709@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Luca Ferrari <fluca1978(at)infinito(dot)it> writes:
> I'm curious to know why, if a table is empty, it seems that an ANALYZE
> of the table does not insert any stats in the pg_stats table,

Uh ... because there are no stats to insert.  The only available
information is that the table is empty, which is something we track in
pg_class not pg_stats.

> Second, if I execute an EXPLAIN 
> on an empty table, even after an ANALYZE of the table, I got an explain that 
> proposes me a row numbers and size that I cannot understand (since it seems to 
> be different depending on the table definition).

That's the planner not wanting to bet on an empty table staying empty.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Tom LaneDate: 2008-10-27 20:16:16
Subject: Re: Execute Shell script after insert
Previous:From: Tom LaneDate: 2008-10-27 19:51:57
Subject: Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group