Re: SELECT INTO large FKyed table is slow - Mailing list pgsql-performance

From Mark Kirkwood
Subject Re: SELECT INTO large FKyed table is slow
Date
Msg-id 4CF58DC5.5040101@catalyst.net.nz
Whole thread Raw
In response to Re: SELECT INTO large FKyed table is slow  ("Pierre C" <lists@peufeu.com>)
List pgsql-performance
On 30/11/10 05:53, Pierre C wrote:
>
>> Yes, since (sample_id, drone_id) is primary key, postgres created
>> composite index on those columns. Are you suggesting I add two more
>> indexes, one for drone_id and one for sample_id?
>
> (sample_id,drone_id) covers sample_id but if you make searches on
> drone_id alone it is likely to be very slow since you got a large
> number of sample_ids. Postgres can use any column of a multicolumn
> index but it is only interesting performance-wise if the cardinality
> of the first (ignored) columns is low. If you often make searches on
> drone_id, create an index. But this isn't what is slowing your foreign
> key checks.

Exactly, sorry - I was having a brain fade moment about which way your
foreign key checks were going when I suggested adding those indexes... :-(

pgsql-performance by date:

Previous
From: "T.H."
Date:
Subject: Re: Question about subselect/IN performance
Next
From: Mario Splivalo
Date:
Subject: Re: SELECT INTO large FKyed table is slow