Re: Open 7.4 items

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Open 7.4 items
Date: 2003-10-06 13:37:42
Message-ID: 3F817026.8000204@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> Oh, that makes me feel better. Do we have timings for this code?
>
> This is just a single data point, but I made a table of 1 million
> rows containing just the int4 primary key column (values 0-1million
> in a somewhat random order). Then I copied the same data, sans index,
> to produce a foreign key table. Then I tried ALTER ADD PRIMARY KEY.
>
> The results were:
>
> Time to load the 1 million rows: 8 sec
>
> Time to create the PK index: 10 sec
>
> Time to ADD PRIMARY KEY:
>
> with CVS-tip code (fire trigger per row): 78 sec
>
> with proposed patch: anywhere from 5 to 25 sec depending on plan
>
> The default plan if there is no index on the FK table (meaning the
> planner will not know its true size) is a nestloop with inner index
> scan taking about 17 sec.

Does an ANALYZE run between index creation and bulk FK checking improve
planning? It's not doing a full DB scan, so it shouldn't do too much
harm, does it?

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-06 13:45:27 Re: Open 7.4 items
Previous Message Jan Wieck 2003-10-06 13:34:24 Re: Open 7.4 items

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-10-06 13:45:27 Re: Open 7.4 items
Previous Message Jan Wieck 2003-10-06 13:34:24 Re: Open 7.4 items