query time

Поиск
Список
Период
Сортировка
От WireSpot
Тема query time
Дата
Msg-id b2d4b03805020202336f0ceccb@mail.gmail.com
обсуждение исходный текст
Ответы Re: query time  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
I have a table with about 200.000 entries. Among other things, it
contains an integer field I use as a timestamp, and a variable
character field I use for user names. Certain queries are taking too
long IMO. I'm trying this on both 7.4 and 8.0.

If I do a direct comparison (using =) on the user name field and I
sort by the numeric field, I get about 5 ms. If I do a LIKE on the
user name and I don't sort at all, I get about 5 ms too. But if I use
both LIKE on the user name and sorting on the timestamp, the time
jumps to 2000 ms.

I have indexes on both fields, but I remember reading only one of them
will be used when doing a query.

Is such a serious jump in query times normal or am I doing something wrong?

I'm attaching the explain output for all 3 cases.

Вложения

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

Предыдущее
От: mike
Дата:
Сообщение: Re: When is a blank not a null or ''
Следующее
От: mike
Дата:
Сообщение: Re: When is a blank not a null or ''