Re: Indexing question - Mailing list pgsql-performance

From Tomasz Myrta
Subject Re: Indexing question
Date
Msg-id 3F4F1575.8090600@klaster.net
Whole thread Raw
In response to Re: Indexing question  ("Alexander Priem" <ap@cict.nl>)
List pgsql-performance
> create index orad_id_index on orderadvice (orad_id) where orad_deleteddate
> is null;
> create index orad_name_index on orderadvice (orad_name) where
> orad_deleteddate is null;
>
> create view orderadvice_edit as select
> orad_id,orad_name,orad_description,orad_value,orad_value_quan from
> orderadvice where orad_deleteddate is null;
>
> Would queries like 'select * from orderadvice_edit where orad_id=100' or
> 'select * from orderadvice_edit order by orad_name' both use one of these
> two partial indexes, given enough records are present in the table?
>
> There would be a double index on the primary key this way, right?

It looks much better now. I'm not sure about the second index. Probably
it will be useless, because you sort ALL records with deleteddtata is
null. Maybe the first index will be enough.

I'm not sure what to do with doubled index on a primary key field.

Regards,
Tomasz Myrta


pgsql-performance by date:

Previous
From: "Alexander Priem"
Date:
Subject: Re: Indexing question
Next
From: "Alexander Priem"
Date:
Subject: Re: Indexing question