Analyze on table creation? - Mailing list pgsql-hackers

From James Coleman
Subject Analyze on table creation?
Date
Msg-id CAAaqYe97qEUwt14C3HRkOhuC1g=DK-B-pij8HGwFaovQMvp1aw@mail.gmail.com
Whole thread Raw
Responses Re: Analyze on table creation?
Re: Analyze on table creation?
List pgsql-hackers
Hello,

Have we ever discussed running an analyze immediately after creating a table?

Consider the following:

create table stats(i int, t text not null);
explain select * from stats;
   Seq Scan on stats  (cost=0.00..22.70 rows=1270 width=36
analyze stats;
explain select * from stats;
   Seq Scan on stats  (cost=0.00..0.00 rows=1 width=36)

Combined with rapidly increasing error margin on row estimates when
adding joins means that a query joining to a bunch of empty tables
when a database first starts up can result in some pretty wild plan
costs.

This feels like a simple idea to me, and so I assume people have
considered it before. If so, I'd like to understand why the conclusion
was not to do it, or, alternatively if it's a lack of tuits.

Regards,
James Coleman



pgsql-hackers by date:

Previous
From: Kirk Wolak
Date:
Subject: Re: pgbnech: allow to cancel queries during benchmark
Next
From: Pavel Stehule
Date:
Subject: Re: Analyze on table creation?