Re: Help optimize view

Поиск
Список
Период
Сортировка
От Relyea, Mike
Тема Re: Help optimize view
Дата
Msg-id 1806D1F73FCB7F439F2C842EE0627B1806666079@USA0300MS01.na.xerox.net
обсуждение исходный текст
Ответ на Re: Help optimize view  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-performance
> From: Kevin Grittner [mailto:Kevin.Grittner@wicourts.gov]
>
> First off, let's make sure we're optimizing the query you
> really want to run.
> AND binds tighter than OR, so as you have it written, it is
> the same as:
>
>   HAVING "PrintSamples"."MachineID" = 4741
>       OR (   "PrintSamples"."MachineID" = 4745
>          AND "AnalysisModules"."AnalysisModuleName" = 'NMF'
>          AND "ParameterNames"."ParameterName" = 'NMF'
>          AND "tblColors"."ColorID" <> 3
>          AND "PrintSamples"."TestPatternName" LIKE 'IQAF-TP8%';
>          )
>
> I fear you may really want it evaluate to:
>
>   HAVING ("PrintSamples"."MachineID" = 4741 OR
> "PrintSamples"."MachineID" = 4745)
>      AND "AnalysisModules"."AnalysisModuleName" = 'NMF'
>      AND "ParameterNames"."ParameterName" = 'NMF'
>      AND "tblColors"."ColorID" <> 3
>      AND "PrintSamples"."TestPatternName" LIKE 'IQAF-TP8%';

The query I really want to run is several times larger than this.  I
didn't think people would want to wade through pages and pages worth of
SQL and then explain analyze results - especially when I'm fairly
certain that optimizing this smaller part of the overall aggregate query
would provide me the help I was looking for.

You're right about what I really want the query to evaluate to.  I'll
give your suggestion a try.  Thanks.

Mike

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

Предыдущее
От: "Andrew Hammond"
Дата:
Сообщение: Re: [pgsql-jobs] Looking for database hosting
Следующее
От: "Campbell, Lance"
Дата:
Сообщение: Terminology Question