[GENERAL] DISTINCT vs GROUP BY - was Re: is (not) distinct from
От | George Neuner |
---|---|
Тема | [GENERAL] DISTINCT vs GROUP BY - was Re: is (not) distinct from |
Дата | |
Msg-id | g7rhbcpnpn4jqokptb3tvc9vl7j13q6c1k@4ax.com обсуждение исходный текст |
Ответ на | [GENERAL] is (not) distinct from (Johann Spies <johann.spies@gmail.com>) |
Ответы |
Re: [GENERAL] DISTINCT vs GROUP BY - was Re: is (not) distinct from
Re: [GENERAL] DISTINCT vs GROUP BY - was Re: is (not) distinct from |
Список | pgsql-general |
On Wed, 01 Mar 2017 11:12:29 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote: >This is a great example of "select distinct" being used as a band-aid >over a fundamental misunderstanding of SQL. It's good advice to never use >"distinct" unless you know exactly why your query is generating duplicate >rows in the first place. On that note: I know most people here don't pay much - or any - attention to SQLServer, however there was an interesting article recently regarding significant performance differences between DISTINCT and GROUP BY as used to remove duplicates. https://sqlperformance.com/2017/01/t-sql-queries/surprises-assumptions-group-by-distinct Now I'm wondering if something similar might be lurking in Postgresql? [Yeah, I know - test it and find out! Thing is, the queries used in the article are not simple. Although not explicitly stated, it hints that - at least for SQLServer - a simple case involving a string column is probably insufficient, and complex scenarios are required to produce significant differences. ] I'll get around to doing some testing soon. For now, I am just asking if anyone has ever run into something like this? George
В списке pgsql-general по дате отправления: