speeding up a query

Поиск
Список
Период
Сортировка
От Marcus Engene
Тема speeding up a query
Дата
Msg-id 4612B53C.30106@engene.se
обсуждение исходный текст
Ответы Re: speeding up a query
Re: speeding up a query
Список pgsql-general
Hi,

I'm on 8.0.10 and there is a query I cannot quite get adequately fast.
Should it take 2.5s to sort these 442 rows? Are my settings bad? Is
my query stupid?

Would appreciate any tips.

Best regards,
Marcus


apa=> explain analyze
apa->  select
apa->      ai.objectid as ai_objectid
apa->  from
apa->      apa_item ai
apa->  where
apa->      idxfti @@ to_tsquery('default', 'KCA0304')  AND
apa->      ai.status = 30
apa->  ORDER BY ai.calc_rating desc
apa->  LIMIT 1000;

 Limit  (cost=54.40..54.43 rows=12 width=8) (actual
time=2650.254..2651.093 rows=442 loops=1)
   ->  Sort  (cost=54.40..54.43 rows=12 width=8) (actual
time=2650.251..2650.515 rows=442 loops=1)
         Sort Key: calc_rating
         ->  Index Scan using apa_item_fts on apa_item ai
(cost=0.00..54.18 rows=12 width=8) (actual time=61.261..2649.045
rows=442 loops=1)
               Index Cond: (idxfti @@ '''kca0304'''::tsquery)
               Filter: (status = 30)
 Total runtime: 2651.659 ms
(7 rows)

apa=> explain analyze
apa->  select
apa->      ai.objectid as ai_objectid
apa->  from
apa->      apa_item ai
apa->  where
apa->      idxfti @@ to_tsquery('default', 'KCA0304')  AND
apa->      ai.status = 30
apa->  LIMIT 1000;

 Limit  (cost=0.00..54.18 rows=12 width=4) (actual time=0.186..18.628
rows=442 loops=1)
   ->  Index Scan using apa_item_fts on apa_item ai  (cost=0.00..54.18
rows=12 width=4) (actual time=0.183..17.999 rows=442 loops=1)
         Index Cond: (idxfti @@ '''kca0304'''::tsquery)
         Filter: (status = 30)
 Total runtime: 19.062 ms
(5 rows)


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

Предыдущее
От: Jaime Silvela
Дата:
Сообщение: Re: COPY FROM - how to identify results?
Следующее
От: "Florian G. Pflug"
Дата:
Сообщение: Nice, web-based SNMP-Frontend for pgsnmpd?