Re: Questions about indexes

Поиск
Список
Период
Сортировка
От Alan Hodgson
Тема Re: Questions about indexes
Дата
Msg-id 200606101411.11880@hal.medialogik.com
обсуждение исходный текст
Ответ на Questions about indexes  ("Pat Maddox" <pergesu@gmail.com>)
Ответы Re: Questions about indexes  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-general
On Saturday 10 June 2006 13:30, "Pat Maddox" <pergesu@gmail.com> wrote:
> I've got a table with that has 5 fields.  Nearly every query I make to
> this table is of the form
> SELECT * FROM table1 WHERE field1='foo' AND field2=7;
>
> It's always those two exact fields.  How should I index this to get
> the best performance?

A single index on field1,field2 (or field2, field1) would obviously be
ideal.

>
> Also, how can I find what other parts of my app would benefit from more
> indexes?

Log the queries that are being run, extract the ones that are run the most,
and examine them and their underlying data in detail and with explain
analyze.

If you can think of a way to force programmers to do this while building
their apps, that would also be useful ...

--
In a truly free society, "Alcohol, Tobacco and Firearms" would be a
convenience store chain.


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

Предыдущее
От: John Gray
Дата:
Сообщение: Re: pgxml & xpath_table
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: TOAST not working