Re: [PERFORM] optimizing queries using IN and EXISTS

2012-07-19 Thread Nick Hofstede
: Re: [PERFORM] optimizing queries using IN and EXISTS Nick Hofstede nick.hofst...@inventivegroup.com writes: I'm surprised at the difference in speed/execution plan between two logically equivalent queries, one using IN, the other using EXISTS. (At least I think they are logically equivalent

[PERFORM] optimizing queries using IN and EXISTS

2012-07-18 Thread Nick Hofstede
Hi, I'm surprised at the difference in speed/execution plan between two logically equivalent queries, one using IN, the other using EXISTS. (At least I think they are logically equivalent) I've created a small setup that illustrates what I mean. Consider the following tables: CREATE TABLE

Re: [PERFORM] optimizing queries using IN and EXISTS

2012-07-18 Thread Peter Geoghegan
On 18 July 2012 17:10, Nick Hofstede nick.hofst...@inventivegroup.com wrote: Hi, I'm surprised at the difference in speed/execution plan between two logically equivalent queries, one using IN, the other using EXISTS. (At least I think they are logically equivalent) They are not logically

Re: [PERFORM] optimizing queries using IN and EXISTS

2012-07-18 Thread Nick Hofstede
: woensdag 18 juli 2012 20:40 Aan: Nick Hofstede CC: pgsql-performance@postgresql.org Onderwerp: Re: [PERFORM] optimizing queries using IN and EXISTS On 18 July 2012 17:10, Nick Hofstede nick.hofst...@inventivegroup.com wrote: Hi, I'm surprised at the difference in speed/execution plan between two

Re: [PERFORM] optimizing queries using IN and EXISTS

2012-07-18 Thread Tom Lane
Nick Hofstede nick.hofst...@inventivegroup.com writes: I'm surprised at the difference in speed/execution plan between two logically equivalent queries, one using IN, the other using EXISTS. (At least I think they are logically equivalent) SELECT * FROM foo WHERE 'text6' IN (SELECT

[PERFORM] Optimizing queries that use temporary tables

2008-01-22 Thread Luiz K. Matsumura
Hello, I'm developing some routines that will use temporary tables and need advice on how to not lose performance. I will insert data in a temporary table and use this data to generate new sets that will update or add to the same temporary table. I have some questions that I'm concerned

Re: [PERFORM] Optimizing queries that use temporary tables

2008-01-22 Thread Scott Marlowe
On Jan 22, 2008 1:32 PM, Luiz K. Matsumura [EMAIL PROTECTED] wrote: Hello, I'm developing some routines that will use temporary tables and need advice on how to not lose performance. I will insert data in a temporary table and use this data to generate new sets that will update or add to

Re: [PERFORM] Optimizing queries

2006-10-02 Thread Simon Riggs
On Tue, 2006-08-08 at 16:42 -0400, Tom Lane wrote: Patrice Beliveau [EMAIL PROTECTED] writes: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something AND TABLE.COLUMN2=somethingelse AND function(TABLE.COLUMN3,TABLE.COLUMN4) 0; I find out that the function process every row even if the row

Re: [PERFORM] Optimizing queries

2006-08-09 Thread Ruben Rubio
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If subquerys are not working I think you should try to create a view with the subquery. Maybe it will work. Patrice Beliveau wrote: Tom Lane wrote: Patrice Beliveau [EMAIL PROTECTED] writes: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something

Re: [PERFORM] Optimizing queries

2006-08-09 Thread Tom Lane
Patrice Beliveau [EMAIL PROTECTED] writes: Tom Lane wrote: PG 8.1 will not reorder WHERE clauses for a single table unless it has some specific reason to do so (and AFAICT no version back to 7.0 or so has done so either...) So there's something you are not telling us that is relevant. here

[PERFORM] Optimizing queries

2006-08-08 Thread Patrice Beliveau
Hi, I have a query that use a function and some column test to select row. It's in the form of: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something AND TABLE.COLUMN2=somethingelse AND function(TABLE.COLUMN3,TABLE.COLUMN4) 0; The result of the function does NOT depend only from the

Re: [PERFORM] Optimizing queries

2006-08-08 Thread Scott Marlowe
On Tue, 2006-08-08 at 12:49, Patrice Beliveau wrote: Hi, I have a query that use a function and some column test to select row. It's in the form of: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something AND TABLE.COLUMN2=somethingelse AND

Re: [PERFORM] Optimizing queries

2006-08-08 Thread Patrice Beliveau
Scott Marlowe wrote: On Tue, 2006-08-08 at 12:49, Patrice Beliveau wrote: Hi, I have a query that use a function and some column test to select row. It's in the form of: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something AND TABLE.COLUMN2=somethingelse AND

Re: [PERFORM] Optimizing queries

2006-08-08 Thread Tom Lane
Patrice Beliveau [EMAIL PROTECTED] writes: SELECT * FROM TABLE WHERE TABLE.COLUMN1=something AND TABLE.COLUMN2=somethingelse AND function(TABLE.COLUMN3,TABLE.COLUMN4) 0; I find out that the function process every row even if the row should be rejected as per the first or the second