Re: [PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread Віталій Тимчишин
2008/11/19 DANIEL CRISTIAN CRUZ <[EMAIL PROTECTED]> > Something weird with your example which doesn't have the same result, see > row count with explain analyze: > My fault. EXCEPT ALL would not work here, so this method with EXCEPT can be used only when either operation is done on unique key on t

Re: [PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread Stephan Szabo
On Wed, 19 Nov 2008, [ISO-8859-5] ??? wrote: > Query 1: > select * from t1 where id not in (select id from t2); > > Query 2 (gives same result as Q1): > select * from t1 except all (select id from t2); It gives the same result as long as no nulls are in either table. If either table

Re: [PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread Віталій Тимчишин
2008/11/19 Stephan Szabo <[EMAIL PROTECTED]> > > On Wed, 19 Nov 2008, [ISO-8859-5] Віталій Тимчишин wrote: > > > Query 1: > > select * from t1 where id not in (select id from t2); > > > > Query 2 (gives same result as Q1): > > select * from t1 except all (select id from t2); > > It gives the same

Re: [PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread Alvaro Herrera
Віталій Тимчишин escribió: > So the question is: I am willing to participate in postgresql development > because it may be easier to fix planner then to rewrite all my queries :). > How can I? (I mean to work on query planner enhancements by providing new > options of query rewrite, not to work on

Re: [PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread DANIEL CRISTIAN CRUZ
Something weird with your example which doesn't have the same result, see row count with explain analyze: cruz=# SELECT version(); version -

[PERFORM] PostgreSQL NOT IN performance

2008-11-19 Thread Віталій Тимчишин
Hello. It's second query rewrite postgresql seems not to handle - making EXCEPT from NOT IT. Here is an example: Preparation: drop table if exists t1; drop table if exists t2; create temporary table t1(id) as select (random()*10)::int from generate_series(1,20) a(id); create temporary ta