Skip site navigation (1) Skip section navigation (2)

Re: a LEFT JOIN problem

From: Thomas <iamkenzo(at)gmail(dot)com>
To: "Sam Mason" <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: a LEFT JOIN problem
Date: 2008-10-30 23:11:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I have found a trick to fool the system: I use an ORDER BY
response_code 0 ASC LIMIT 1

As unpaid orders receive a response_code > 0, then necessarily the
first record has response_code of 0.

However if more and more orders come into the equation, this means
PgSQL will have to process more records, how is it optimized? I guess
PgSQL will have to find all the records, than order them by
response_code ASC, and then pick the first one.

This is probably not a good practice? Should I go for 2 distinct queries?

In response to

pgsql-general by date

Next:From: Noah FreireDate: 2008-10-30 23:29:29
Subject: Re: autovacuum
Previous:From: ThomasDate: 2008-10-30 23:01:28
Subject: Re: a LEFT JOIN problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group