Re: index creation order?

From: Chester Kustarz <chester(at)arbor(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: index creation order?
Date: 2003-10-31 20:32:30
Message-ID: Pine.BSO.4.44.0310311518100.10754-100000@detroit.arbor.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message PostgreSQL 2003-10-31 20:55:12 Postgres 7.3.4 + Slackware 9.1
Previous Message Allen Landsidel 2003-10-31 19:01:28 Re: index creation order?