Re: Need help optimizing this query

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: "Pat Maddox" <pergesu(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help optimizing this query
Date: 2007-07-18 21:29:21
Message-ID: E0EBE358-52A7-49EC-BB5D-C15E40AE6698@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)seespotcode(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2007-07-18 21:34:46 Re: DBI/DBD::Pg and transactions
Previous Message Roderick A. Anderson 2007-07-18 21:29:09 Re: DBI/DBD::Pg and transactions