Re: Drawing a blank on some SQL - Mailing list pgsql-sql

From Samuel Gendler
Subject Re: Drawing a blank on some SQL
Date
Msg-id AANLkTikLJ6bqjasftLOPx0LV4mfw-ngBoPLw_FdDm9Lh@mail.gmail.com
Whole thread Raw
In response to Re: Drawing a blank on some SQL  (Aaron Burnett <aburnett@bzzagent.com>)
List pgsql-sql
On Fri, Feb 11, 2011 at 12:47 PM, Aaron Burnett <aburnett@bzzagent.com> wrote:


Thank you all very much for your help.

The suggestion from Osvaldo below was the best for my situation (not having any soret of xref table to join)...



It may work well for now, but if that foo_activity table has the potential to get large with only a relatively small percentage of rows fitting in the date range, it will get very slow compared to the left join, as it requires loading every row in the table, instead of being able to use an index to pull just the rows from the date range and then join to the list of valid activities.  

--sam

pgsql-sql by date:

Previous
From: Aaron Burnett
Date:
Subject: Re: Drawing a blank on some SQL
Next
From: Jasen Betts
Date:
Subject: Re: DELETE FROM takes forever