Re: Multiple Uniques
От | Neil Conway |
---|---|
Тема | Re: Multiple Uniques |
Дата | |
Msg-id | 4140E1EF.1040303@samurai.com обсуждение исходный текст |
Ответ на | Re: Multiple Uniques (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Multiple Uniques
|
Список | pgsql-performance |
Tom Lane wrote: > Markus Schaber <schabios@logi-track.com> writes: >>So, now my question is, why does the query optimizer not recognize that >>it can throw away those "non-unique" Sort/Unique passes? > > Because the issue doesn't come up often enough to justify expending > cycles to check for it. How many cycles are we really talking about, though? I have a patch which I'll send along in a few days which implements a similar optimization: if a subselect is referenced by EXISTS or IN, we can discard DISTINCT and ORDER BY clauses in the subquery (actually, we can't discard ORDER BY in the case of IN if LIMIT is also specified, but the point remains). It's very cheap computationally for the planner to do this simplification, and I'd imagine doing the equivalent simplifications for UNION is similarly cheap. While I understand what you're saying WRT to it being a silly query, in the real world people make mistakes... -Neil
В списке pgsql-performance по дате отправления: