Re: index creation order? - Mailing list pgsql-performance

From Chester Kustarz
Subject Re: index creation order?
Date
Msg-id Pine.BSO.4.44.0310311518100.10754-100000@detroit.arbor.net
Whole thread Raw
In response to Re: index creation order?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: index creation order?
Re: index creation order?
List pgsql-performance
is there any way to update the stats inside a transaction? what i have is
something like:

select count(*) from foo;
-> 0

begin;

copy foo from '/tmp/foo'; -- about 100k rows

-- run some queries on foo which perform horribly because the stats
-- are way off (100k rows v. 0 rows)

commit;


it seems that you cannot run analyze inside a transaction:

begin;
analyze foo;
ERROR:  ANALYZE cannot run inside a BEGIN/END block

i am using version 7.2.3.

any work-a-rounds? should i try updating pg_statistic manually?

On Fri, 31 Oct 2003, Josh Berkus wrote:
> Among other things, ANALYZE tells postgres how many rows are in the table.  So
> if you add a PK constraint after loading 10 million rows without ANALYZE,
> PostgreSQL is likely to think that there is only one row in the table ... and
> choose a nested loop or some other really inefficient method of checking for
> uniqueness.


pgsql-performance by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Pg+Linux swap use
Next
From: "PostgreSQL"
Date:
Subject: Postgres 7.3.4 + Slackware 9.1