pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Thorsen <mthorsen1980@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: SQL query
Date: Sat, 22 Nov 2008 13:17:15 -0500
Message-ID: <29116.1227377835@sss.pgh.pa.us> (raw)
In-Reply-To: <4c8d33a90811212033x5e88177eo7a026b10336c975b@mail.gmail.com>
References: <4c8d33a90811212033x5e88177eo7a026b10336c975b@mail.gmail.com>

"Michael Thorsen" <mthorsen1980@gmail.com> writes:
> ... I gave a simple example above, but the query runs over 2 tables
> with about a million entries in each. So I am unable to verify what is
> wrong, but I know the count is incorrect as I should not have more than what
> is in the user_table.

You could easily get a count larger than the number of rows in
user_table, if there are rows in user_table that join to multiple rows
in the locations table.  So look for duplicated data in locations ...

			regards, tom lane



view thread (45+ messages)  latest in thread

Message-ID: <29116.1227377835@sss.pgh.pa.us>
Permalink:  ../29116.1227377835@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29116.1227377835@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mthorsen1980@gmail.com
  Subject: Re: SQL query
  In-Reply-To: <29116.1227377835@sss.pgh.pa.us>
  References: <4c8d33a90811212033x5e88177eo7a026b10336c975b@mail.gmail.com> <29116.1227377835@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox