Re: [SQL] How to optimize a query...

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: [SQL] How to optimize a query...
Дата
Msg-id 36E56EC4.F9AD68E8@rice.edu
обсуждение исходный текст
Ответ на How to optimize a query...  (secret <secret@kearneydev.com>)
Список pgsql-sql
secret wrote:
<description of sloq query, with proper EXPLAIN output... thanks!>

Hmm, it looks like your tables are big enough to benefit from indices,
but the query plan didn't choose any. I'd guess an index on po.po_id,
and perhaps tickets.material_po and tickets.trucking_po might help.

From what I understand, indices are of most use on attributes (fields)
that are mostly unique, like your po_id is (probably). They can hurt you
if you build them on fields that are mostly _not_ unique (the classic
example being a gender field - only two likely values, lost of rows
returned for either, so you scan anyway...)

Any real experts out there to correct me? ;-)

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

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

Предыдущее
От: Fernezelyi Marton
Дата:
Сообщение: help
Следующее
От: "Tim Perdue"
Дата:
Сообщение: Performance