Re: a question for the way-back machine - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: a question for the way-back machine
Date
Msg-id 20061213220552.GG15546@svana.org
Whole thread Raw
In response to Re: a question for the way-back machine  (Ben <bench@silentmedia.com>)
Responses Re: a question for the way-back machine  (Ben <bench@silentmedia.com>)
List pgsql-general
On Wed, Dec 13, 2006 at 02:01:46PM -0800, Ben wrote:
>
>
> On Wed, 13 Dec 2006, Martijn van Oosterhout wrote:
>
> >>- 7.3 isn't smart enough to use an index on an insert? Seems unlikely.
> >
> >This question makes no sense, you don't need an index to insert.
>
> Wouldn't it need to check the unique constraint (an index on the table)
> before the insert can succeed? It seems like it would be better to check
> the index than to do a full table scan to try to satisfy that constraint.

When you insert a tuple, it needs to be inserted into the index, yes. There
is no way an insert can cause a sequential scan, except by some trigger
defined on the table.

> >Are you sure it's not due to some foreign key check?
>
> No, but it seems unlikely, given that the vast majority of activity is
> inserts into a single table, and that this table has massive amounts of
> sequential scans according to pg_stat_user_tables.

You're not doing a select within the insert statement are you?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: plperl exception catching
Next
From: Martijn van Oosterhout
Date:
Subject: Re: plperl exception catching