Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 488E86347FD for ; Fri, 8 May 2009 16:52:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20828-05 for ; Fri, 8 May 2009 16:52:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id C53C46347E7 for ; Fri, 8 May 2009 16:52:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n48JqhAi013495; Fri, 8 May 2009 15:52:43 -0400 (EDT) To: Maximilian Tyrtania cc: Scott Marlowe , pgsql-sql@postgresql.org Subject: Re: Distinct oddity In-reply-to: References: Comments: In-reply-to Maximilian Tyrtania message dated "Fri, 08 May 2009 11:28:40 +0200" Date: Fri, 08 May 2009 15:52:43 -0400 Message-ID: <13494.1241812363@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/37 X-Sequence-Number: 32529 Maximilian Tyrtania writes: > am 07.05.2009 20:54 Uhr schrieb Scott Marlowe unter scott.marlowe@gmail.com: >> Yeah, that does seem odd. Could it be something like nulls in your >> data set? just guessing really. If you could make a small test case >> that shows it happening and allows others to reproduce it you're >> likely to get more bites. > It doesn't seem to be related to null values (which wouldn't explain it > anyway) nor to this particular field... Can you reproduce it in other contexts than specifically count(distinct)? In particular I'd try select count(*) from (select distinct f.bezeichnung from firmen f) ss; select count(*) from (select distinct f.bezeichnung||'e' from firmen f) ss; If those give the same numbers as you're showing here, then the next step would be to dump out the actual results of the SELECT DISTINCT queries and compare them --- looking at the actual data values should give some insight as to what's happening. BTW, what is the datatype of f.bezeichnung, and what locale are you running in? regards, tom lane