Re: Performance (was: The New Slashdot Setup (includes MySql server))

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matthias Urlichs" <smurf(at)noris(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Performance (was: The New Slashdot Setup (includes MySql server))
Date: 2000-05-20 00:32:18
Message-ID: 10532.958782738@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

I wrote:
>>>>> Nonono, the 1000 read() calls are triggered by a simple INSERT or UPDATE
>>>>> call. They actually scan the pg_index table of the benchmark database.
>
> Ohh ... pg_index is the culprit! OK, I know exactly where that's coming
> from: the planner is looking around to see what indexes might be
> interesting for planning the query. Several comments here:
>
> 1. Probably we ought to try to bypass most of the planning process for
> a simple INSERT ... VALUES. (I thought I had fixed that, but apparently
> it's not getting short-circuited soon enough, if the search for indexes
> is still happening.)

It never pays to assume you know what's happening without having looked
:-(. It turns out the planner is not the only culprit: the executor's
ExecOpenIndices() routine *also* does a sequential scan of pg_index.
I did shortcircuit the planner's search in the INSERT ... VALUES case,
but of course the executor still must find out whether the table has
indexes.

In UPDATE, DELETE, or INSERT ... SELECT, pg_index is scanned *twice*,
once in the planner and once in the executor. (In fact it's worse
than that: the planner scans pg_index separately for each table named
in the query. At least the executor only does it once since it only
has to worry about one target relation.)

Definitely need to cache the indexing information...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Dlug 2000-05-20 01:31:33 Re: Zip Code Proximity
Previous Message Chris 2000-05-20 00:26:35 Re: OO Patch

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-05-20 01:46:43 Re: Performance (was: The New Slashdot Setup (includes MySql server))
Previous Message Chris 2000-05-20 00:26:35 Re: OO Patch