Re: Problem with query

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: chris(at)chriscurvey(dot)com
Cc: Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with query
Date: 2014-04-11 20:48:00
Message-ID: CAOzAquKTanKKONL0NXO=0SneQfG7W+tspcJHJTA7KUtmbNC-Aw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/11/14, Chris Curvey <chris(at)chriscurvey(dot)com> wrote:
> On Fri, Apr 11, 2014 at 1:50 PM, Susan Cassidy <
> susan(dot)cassidy(at)decisionsciencescorp(dot)com> wrote:
>
>> I have a query with several joins, where I am searching for specific data
>> in certain columns.

Have you tried running each of your joins separately to see if there
are row values common to both tables, ie:

select count(*) from scenes s
left outer join scene_thing_instances si on s.scene_id =
si.scene_id

then

select count(*) from scene_thing_instances si
left outer join scene_things st on si.scene_thing_id =
st.scene_thing_id

etc.

I find when building complex queries (I've written some that ran over
100 lines and involved a dozen or more joined tables), I need to build
them up, testing them as I build.
--
Mike Nolan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Moshe Jacobson 2014-04-11 21:02:15 Re: Database Design: Maintain Audit Trail of Changes
Previous Message Chris Curvey 2014-04-11 18:26:09 Re: Problem with query