Re: Help optimize view
От | Kevin Grittner |
---|---|
Тема | Re: Help optimize view |
Дата | |
Msg-id | 46C7502D.EE98.0025.0@wicourts.gov обсуждение исходный текст |
Ответ на | Help optimize view ("Relyea, Mike" <Mike.Relyea@xerox.com>) |
Ответы |
Re: Help optimize view
|
Список | pgsql-performance |
>>> On Fri, Aug 10, 2007 at 11:57 AM, in message <1806D1F73FCB7F439F2C842EE0627B18065BEC18@usa0300ms01.na.xerox.net>, "Relyea, Mike" <Mike.Relyea@xerox.com> wrote: > I'm have the following view as part of a larger, aggregate query that is > running slower than I'd like. > . . . > 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%'; 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%'; -Kevin
В списке pgsql-performance по дате отправления: