Re: combine SQL SELECT statements into one

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Igor Neyman <ineyman(at)perceptron(dot)com>
Cc: Chris(dot)Ellis(at)shropshire(dot)gov(dot)uk, neilstylz(at)yahoo(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: combine SQL SELECT statements into one
Date: 2010-02-01 20:25:41
Message-ID: dcc563d11002011225p80b1af7ta400155584e1f1fb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

On Mon, Feb 1, 2010 at 12:09 PM, Igor Neyman <ineyman(at)perceptron(dot)com> wrote:
> Original poster asked for the sql that will touch inventory table only
> once.
>
> Your statement (with 3 subqueries) will do it 3 times.

I'm pretty sure that starting with 8.3 the engine will collapse all
those into one seq scan internally.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris.Ellis 2010-02-01 20:39:53 Re: combine SQL SELECT statements into one
Previous Message frank joerdens 2010-02-01 20:22:38 Locking referenced table when creating and dropping tables with foreign key constraints

Browse pgsql-novice by date

  From Date Subject
Next Message Chris.Ellis 2010-02-01 20:39:53 Re: combine SQL SELECT statements into one
Previous Message Igor Neyman 2010-02-01 19:09:48 Re: combine SQL SELECT statements into one

Browse pgsql-sql by date

  From Date Subject
Next Message Chris.Ellis 2010-02-01 20:39:53 Re: combine SQL SELECT statements into one
Previous Message Adam Sherman 2010-02-01 20:11:22 Re: Crosstab Confusion