Re: Need help optimizing this query - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Need help optimizing this query
Date
Msg-id E0EBE358-52A7-49EC-BB5D-C15E40AE6698@seespotcode.net
Whole thread Raw
In response to Re: Need help optimizing this query  ("Pat Maddox" <pergesu@gmail.com>)
Responses Re: Need help optimizing this query
List pgsql-general
On Jul 18, 2007, at 16:12 , Pat Maddox wrote:

> ERROR:  invalid reference to FROM-clause entry for table "video_views"
> LINE 20: JOIN assets ON (video_views.video_id=videos.id)
>                         ^
> HINT:  There is an entry for table "video_views", but it cannot be
> referenced from this part of the query.

It's because I mismatched the JOIN clauses during my copy-and-paste :(

> On 7/18/07, Michael Glaesemann <grzm@seespotcode.net> wrote:

>> FROM video_views
>> JOIN assets ON (video_views.video_id=videos.id)
>> JOIN videos ON (video_views.asset_id=assets.id)

This should be

FROM video_views
JOIN assets ON (video_views.asset_id=assets.id)
JOIN videos ON (video_views.video_id=videos.id)

Do you have the EXPLAIN ANALYE output of the query?

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Update of table lags execution of statement by >1 minute?
Next
From: "Roderick A. Anderson"
Date:
Subject: Re: DBI/DBD::Pg and transactions