Re: Or selection on index versus union

Поиск
Список
Период
Сортировка
От han.holl@informationslogik.nl
Тема Re: Or selection on index versus union
Дата
Msg-id 200510051113.58608.han.holl@informationslogik.nl
обсуждение исходный текст
Ответ на Re: Or selection on index versus union  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Or selection on index versus union
Re: Or selection on index versus union
Список pgsql-general

On Tuesday 04 October 2005 23:08, Michael Fuhr wrote:

> On Tue, Oct 04, 2005 at 09:32:41PM +0200, han.holl@informationslogik.nl wrote:

> > I've got a table with an index, let's call it fase.

> >

> > The following query is fine: 'select something from table where fase =

> > '1';

> >

> > However, this is disastrously slow:

> > select something from table where fase = '1' or fase = '2';

>

> Could we see some EXPLAIN ANALYZE output? What version of PostgreSQL

> are you using? Have you run VACUUM ANALYZE on the table to remove

> dead tuples and update the statistics? Have you considered clustering

> the table on fase's index?

>

Oh, well, thanks. I hadn't realized that a newly loaded database needs a vacuum analyze to begin with. And what's worse, I had the impression that vacuum full would include analyze, wich I see now it doesn't.

I'm not a database administrator, and I'm afraid it shows. I'm going to read a lot of docs in the coming months, because real people depend on reasonable performance of our databases.

Cheers, and thanks again,

Han Holl

PS We still have to be careful how to formulate conditions:

where fase in ('1','2')

is ok, and uses the index, but the logically identical:

where position(fase in '12') >= 1

does a sequential scan.

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: transaction toggling
Следующее
От: Markus Schulz
Дата:
Сообщение: Re: selfmade datatype in C and server-crash