Re: Takes too long to fetch the data from database

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Takes too long to fetch the data from database
Дата
Msg-id b42b73150604110613h2c63ea61oec8035c8e2f4ed98@mail.gmail.com
обсуждение исходный текст
Ответ на Takes too long to fetch the data from database  ("soni de" <soni.de@gmail.com>)
Ответы Re: Takes too long to fetch the data from database  ("soni de" <soni.de@gmail.com>)
Список pgsql-performance
> pdb=# explain analyze SELECT sdate, stime, rbts from lan WHERE (
>
>  ( bname = 'pluto' ) AND ( cno = 17 ) AND ( pno = 1 ) AND ( ( sdate
>
>  >= '2004-07-21' ) AND ( sdate <= '2004-07-21' ) )  )  ORDER BY sdate, stime
> ;

this query would benefit from an index on
pluto, cno, pno, sdate

create index Ian_idx on Ian(bname, cno, pno, sdate);


> pdb=# explain analyze SELECT ALL sdate, stime, rbts from lan WHERE (  (
> bname = 'neptune' ) AND ( cno = 17 ) AND ( pno = 1 ) AND ( ( sdate >=
> '2004-07-21' ) AND ( sdate <= '2004-07-21' ) )  )  ORDER BY sdate, stime ;

ditto above.  Generally, the closer the fields in the where clause are
matched by the index, the it will speed up your query.

Merlin

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

Предыдущее
От: "Jesper Krogh"
Дата:
Сообщение: Re: Restore performance?
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Stored Procedure Performance