Re: Optimizing NOT IN plans / verify rewrite

From: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Dave Crooke <dcrooke(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizing NOT IN plans / verify rewrite
Date: 2010-08-02 22:37:21
Message-ID: AANLkTinv5urC2Y6iKV6YGipGYfLOeo4Vh74F-4ByK+uG@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>> Maybe before I get excited I should try it with a query which is
>> actually logically equivalent.

Yes, the joys of manual rewrites...

> Fixed version:
>
> DELETE FROM foo
> where type = 'o' and foo.b in (
> select b from foo WHERE type = 'o'
> except SELECT b FROM bar
> except SELECT b FROM foo where type <> 'o');
>
> The change didn't affect run time significantly; it still beats the
> others.

On my 8.3, it still performs a little worse than your original
correlated EXCEPT (which is actually on par with the antijoin in 8.3,
but significantly better in 8.4). In 8.4, this EXCEPT version does
seem somewhat better.

It looks like according to Andres, though, I should not be depending
on these plans with 8.3, so I may want to stick with the manual
antijoin.

---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2010-08-03 00:07:43 Re: Testing Sandforce SSD
Previous Message Josh Berkus 2010-08-02 22:21:41 Re: Testing Sandforce SSD