Re: MAX/MIN optimization via rewrite (plus query rewrites
От | Dawid Kuroczko |
---|---|
Тема | Re: MAX/MIN optimization via rewrite (plus query rewrites |
Дата | |
Msg-id | 758d5e7f04111423557f06ce01@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: MAX/MIN optimization via rewrite (plus query rewrites (Greg Stark <gsstark@mit.edu>) |
Список | pgsql-hackers |
On 15 Nov 2004 02:00:37 -0500, Greg Stark <gsstark@mit.edu> wrote: > I think people should get away from thinking about "order by + limit". That > isn't going to work for anything with a GROUP BY. And it isn't going to work > for anything more complex than a single min() or max(). > > min() only needs the first record from whatever set of records it's operating > on as long as they're provided in a specified order. This is just as true for > a min() applied to only a single GROUP as it is for a min() applied to an > entire table. But as far as I can tell there is no way of forcing such order, at least ORDER BY queries are doomed to fail: select max(val) from test_max order by val desc; ERROR: column "test_max.val" must appear in the GROUP BY clause or be used in an aggregate function Anyway I think that any optimization (supposedly "imlicit" order by when min() or max() is the only requested column) would at least stop people from using awkward syntax for performance reasons... Regards, Dawid
В списке pgsql-hackers по дате отправления: