Re: Indexing question

Поиск
Список
Период
Сортировка
От Alexander Priem
Тема Re: Indexing question
Дата
Msg-id 01bf01c36e0d$18769280$b696a8c0@APR
обсуждение исходный текст
Ответ на Indexing question  ("Alexander Priem" <ap@cict.nl>)
Ответы Re: Indexing question
Список pgsql-performance
The first index is for sorting on orad_id, the second one for sorting on
orad_name. The first one would be useful for queries like 'select * from
orderadvice_edit where orad_id=100', the second one for queries like 'select
* from orderadvice_edit order by orad_name'. Right?

Does anyone know whether it is bad practise to have two indexes on the
primary key of a table? (one 'primary key' index and one partial index)




----- Original Message -----
From: "Tomasz Myrta" <jasiek@klaster.net>
To: "Alexander Priem" <ap@cict.nl>
Cc: <pgsql-performance@postgresql.org>
Sent: Friday, August 29, 2003 10:57 AM
Subject: Re: [PERFORM] Indexing question


> > 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend


В списке pgsql-performance по дате отправления:

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: Indexing question
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Hardware recommendations to scale to silly load