Re: DISTINCT/Optimizer question
От | Tom Lane |
---|---|
Тема | Re: DISTINCT/Optimizer question |
Дата | |
Msg-id | 25726.1152845601@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | DISTINCT/Optimizer question ("Beth Jen" <raelys@gmail.com>) |
Ответы |
Re: DISTINCT/Optimizer question
|
Список | pgsql-hackers |
Hi Beth, "Beth Jen" <raelys@gmail.com> writes: > Right now, the distinct clause adds its targets to the sort clause list when > it is parsed. Yeah, the DISTINCT/DISTINCT ON implementation is currently rather tightly tied to sorting :-(. This is ancient code and badly in need of redesign, but it's not clear how to clean it up without breaking the expected behavior of DISTINCT ON. There may not be any alternative except to divorce DISTINCT from DISTINCT ON and make them two separate code paths, but that's hardly appealing. On the other side of the coin, there's the analogy to GROUP BY that Greg points out --- there's some duplicated functionality there, but again it doesn't carry over to DISTINCT ON, AFAICS. It might work to have parse analysis not add the DISTINCT list to the ORDER BY list, but instead store them as separate Query fields, and have the planner add DISTINCT to ORDER BY if it decides to use sort-based distinct-ing. I'm not sure if there's any good way to merge all three constructs (DISTINCT, DISTINCT ON, GROUP BY). regards, tom lane
В списке pgsql-hackers по дате отправления: