On 31 Srpen 2011, 16:49, Andy Colson wrote:
> On 8/31/2011 9:35 AM, Tore Halvorsen wrote:
>> Hi,
>>
>> I'm trying to optimize a query where I have two tables that both have a
>> timestamp column. I want the result where either of the timestamps is
>> after a specified time. In a reduced form, like
On 8/31/2011 9:53 AM, Tore Halvorsen wrote:
On Wed, Aug 31, 2011 at 4:49 PM, Andy Colson mailto:a...@squeakycode.net>> wrote:
On PG 9, after I ANALYZED the tables, it used indexes:
QUERY PLAN
--__--__-
On Wed, Aug 31, 2011 at 4:49 PM, Andy Colson wrote:
> On PG 9, after I ANALYZED the tables, it used indexes:
>
>
> QUERY PLAN
> --**--**
> --**-
> Merge Join (cost=1.59..82778.35 rows=13171 w
On 8/31/2011 9:35 AM, Tore Halvorsen wrote:
Hi,
I'm trying to optimize a query where I have two tables that both have a
timestamp column. I want the result where either of the timestamps is
after a specified time. In a reduced form, like this:
CREATE TABLE a
(
id serial NOT NULL PRIMARY KEY
>
> -- This can be optimized by using CTEs
> with am as (
> select * from a where time >= '2011-08-15'
> )
> , bm as (
> select * from b where time >= '2011-08-15'
> )
> select * from am join bm using(id)
>
Disregard this, it doesn't to the same at all.
Now I'm more confused as to how I can o