Re: Optimize the query, help me please.

From: Bèrto ëd Sèra <berto(dot)d(dot)sera(at)gmail(dot)com>
To: Капралов Александр <alnkapa(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimize the query, help me please.
Date: 2011-11-23 11:08:37
Message-ID: CAKwGa_8oFaFzVZqPF6goqKOrSj8Y-oo2jtUoMkrsoE2_Ekv0BQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

(SELECT * FROM a limit 10) union (SELECT * FROM b limit 10)

is what you need

Bèrto

2011/11/23 Капралов Александр <alnkapa(at)gmail(dot)com>

> Query is:
> SELECT * FROM a UNION SELECT * FROM b ORDER BY time DESC LIMIT 100
>
> how can i get only last 100 row from a and b and then do union. Explain of
> select said that all recond selected from a and b.
>
> thanks.
>

--
==============================
If Pac-Man had affected us as kids, we'd all be running around in a
darkened room munching pills and listening to repetitive music.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2011-11-23 11:17:20 Re: Optimize the query, help me please.
Previous Message Raymond O'Donnell 2011-11-23 11:07:29 Re: Optimize the query, help me please.