statistics about tamp tables ...

From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: statistics about tamp tables ...
Date: 2003-11-26 09:06:52
Message-ID: 3FC46D2C.8070501@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Recently I have come across a simple issue which made me think about it.
When we create a tmp table (SELECT INTO, CREATE TABLE AS) the planner
won't know anything about its content after creating it.
Many people use temp tables heavy when the amount of data for a certain
analysis has to be reduced significantly. Frequently the same tmp table
is queried quite frequently. In order to speed those scenarios up it can
be useful to vacuum those tmp tables so that the planner will find more
clever joins.
Is it possible and does it make sense to generate those statistics on
the fly (during CREATE TABLE AS)? Maybe we could have a GUC which tells
the system whether to generate statistics or not.

test=# select * from test;
id
----
4
4
(2 rows)

test=# VACUUM test ;
VACUUM

test=# explain select * from test ;
QUERY PLAN
----------------------------------------------------
Seq Scan on test (cost=0.00..1.02 rows=2 width=4)
(1 row)

test=# select * into tmp from test;
SELECT
test=# explain select * from tmp;
QUERY PLAN
-------------------------------------------------------
Seq Scan on tmp (cost=0.00..20.00 rows=1000 width=4)
(1 row)

Best regards,

Hans

--
Cybertec Geschwinde u Schoenig
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/2952/30706 or +43/660/816 40 77
www.cybertec.at, www.postgresql.at, kernel.cybertec.at

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2003-11-26 10:09:31 Re: pg_restore and create FK without verification check
Previous Message ow 2003-11-26 09:00:52 pg_restore and create FK without verification check