<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>select * from depesz; &#187; distinct</title>
	<atom:link href="http://www.depesz.com/tag/distinct/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.depesz.com</link>
	<description></description>
	<lastBuildDate>Mon, 07 May 2012 20:34:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Getting unique elements</title>
		<link>http://www.depesz.com/2010/04/19/getting-unique-elements/</link>
		<comments>http://www.depesz.com/2010/04/19/getting-unique-elements/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 11:46:38 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[aggregate]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[unique]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1665</guid>
		<description><![CDATA[Let&#8217;s assume you have some simple database with &#8220;articles&#8221; &#8211; each article can be in many &#8220;categories&#8221;. And now you want to get list of all articles in given set of categories. Standard approach: select a.* from articles as a join articles_in_categories as aic on a.id = aic.article_id where aic.category_id in (14,62,70,53,138) Will return duplicated [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2010/04/19/getting-unique-elements/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Waiting for 8.5 &#8211; hinting for number of distinct values</title>
		<link>http://www.depesz.com/2009/08/12/waiting-for-8-5-hinting-for-number-of-distinct-values/</link>
		<comments>http://www.depesz.com/2009/08/12/waiting-for-8-5-hinting-for-number-of-distinct-values/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 14:45:28 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[analyze]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[pg85]]></category>
		<category><![CDATA[pg90]]></category>
		<category><![CDATA[planner]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1477</guid>
		<description><![CDATA[Robert Haas wrote, and Tom Lane committed (on 2nd of August) patch which adds interesting capability: Log Message: ----------- Add ALTER TABLE ... ALTER COLUMN ... SET STATISTICS DISTINCT &#160; Robert Haas Log message is rather terse, so what does it exactly do? To plan query for execution PostgreSQL has to know some basic statistics [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/08/12/waiting-for-8-5-hinting-for-number-of-distinct-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting list of unique elements</title>
		<link>http://www.depesz.com/2009/07/10/getting-list-of-unique-elements/</link>
		<comments>http://www.depesz.com/2009/07/10/getting-list-of-unique-elements/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 09:48:53 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[unique]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1455</guid>
		<description><![CDATA[Every so often you need to get list of unique elements in some column. The standard way to do it is: select distinct column from table; or select column from table group by column; The only problem is that it&#8217;s slow &#8211; as it has to seq scan whole table. Can it be done faster? [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/07/10/getting-list-of-unique-elements/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Waiting for 8.4 &#8211; hash based DISTINCT</title>
		<link>http://www.depesz.com/2008/08/05/waiting-for-84-hash-based-distinct/</link>
		<comments>http://www.depesz.com/2008/08/05/waiting-for-84-hash-based-distinct/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 09:39:20 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[pg84]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1231</guid>
		<description><![CDATA[Today Tom Lane committed patch which gives DISTINCT ability to use hash aggregate &#8211; just like GROUP BY. Log message: Improve SELECT DISTINCT to consider hash aggregation, as well as sort/uniq, as methods for implementing the DISTINCT step. This eliminates the former performance gap between DISTINCT and GROUP BY, and also makes it possible to [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/08/05/waiting-for-84-hash-based-distinct/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Counting number of distinct elements</title>
		<link>http://www.depesz.com/2008/05/22/counting-number-of-distinct-elements/</link>
		<comments>http://www.depesz.com/2008/05/22/counting-number-of-distinct-elements/#comments</comments>
		<pubDate>Thu, 22 May 2008 15:41:43 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[surprise]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1210</guid>
		<description><![CDATA[When I was working for one of customers we found some strange thing. We needed to found number of distinct sessions per day. Table layout was very simple: Table "public.some_test_table" Column &#124; Type &#124; Modifiers --------------+------------------------+----------- logdate &#124; date &#124; sessionid &#124; character varying(32) &#124; ... Basically, every session can appear many times during a [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/05/22/counting-number-of-distinct-elements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

