From: Bruce Momjian <maillist@candle.pha.pa.us>
To: Michael Richards <miker@scifair.acadiau.ca>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Stats on new tables
Date: Tue, 26 Oct 1999 00:20:41 -0400 (EDT)
Message-ID: <199910260420.AAA18449@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.BSF.4.10.9910241553001.46045-100000@scifair.acadiau.ca>
> I think I've found something of interest.
> When I create a new table, the plan for it believes that the table
> contains 2 rows, not 0. Also, since the engine knows when we run an
> insert, and also knows how many rows a delete nukes, wouldn't it be better
> to update the stats after every select and delete?
We believe the overhead of that would be high vs. the benefits.
>
> -Michael
>
>
> equipment=> CREATE TABLE xuserid(
> equipment-> oldid varchar(12),
> equipment-> newid int4,
> equipment-> PRIMARY KEY (oldid,newid)
> equipment-> );
> NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
> 'xuserid_pkey' for table 'xuserid'
> CREATE
> equipment=> \d xuserid_pkey
> Table = xuserid_pkey
> +----------------------------------+----------------------------------+-------+
> | Field | Type |
> Length|
> +----------------------------------+----------------------------------+-------+
> | oldid | varchar() |
> 12 |
> | newid | int4 |
> 4 |
> +----------------------------------+----------------------------------+-------+
> equipment=> explain select * from xuserid where newid=859;
> NOTICE: QUERY PLAN:
>
> Seq Scan on xuserid (cost=43.00 rows=2 width=16)
>
> EXPLAIN
> equipment=> vacuum analyze;
> VACUUM
> equipment=> explain select * from xuserid where newid=859;
> NOTICE: QUERY PLAN:
>
> Seq Scan on xuserid (cost=0.00 rows=0 width=16)
>
> EXPLAIN
>
>
> ************
>
>
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: maillist@candle.pha.pa.us, miker@scifair.acadiau.ca
Subject: Re: [SQL] Stats on new tables
In-Reply-To: <199910260420.AAA18449@candle.pha.pa.us>
References: <Pine.BSF.4.10.9910241553001.46045-100000@scifair.acadiau.ca> <199910260420.AAA18449@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox