From: Humair Mohammed <humairm(at)hotmail(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject:
Date: 2010-11-15 20:14:26
Message-ID: COL115-W5250BF8BDC50E0A64DABE4A8360@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


I have 2 tables with a 200,000 rows of data 3 character/string columns ID, Question and Response. The query below compares the data between the 2 tables based on ID and Question and if the Response does not match between the left table and the right table it identifies the ID's where there is a mismatch. Running the query in SQL Server 2008 using the ISNULL function take a few milliseconds. Running the same query in Postgresql takes over 70 seconds. The 2 queries are below:
SQL Server 2008 R2 Queryselect t1.id from table1 t1 inner join table2 t2 on t1.id = t2.id and t1.question = t2.question and isnull(t1.response,'ISNULL') <> isnull(t2.response,'ISNULL')
Postgres 9.1 Queryselect t1.id from table1 t1 inner join table2 t2 on t1.id = t2.id and t1.question = t2.question and coalesce(t1.response,'ISNULL') <> coalesce(t2.response,'ISNULL')
What gives?

Responses

  • Re: at 2010-11-16 07:00:54 from Jayadevan M
  • Re: at 2010-11-16 07:08:30 from Mark Kirkwood
  • Re: at 2010-11-16 07:12:03 from Pavel Stehule

Browse pgsql-performance by date

  From Date Subject
Next Message Artur Zając 2010-11-15 20:43:48 Re: Difference between explain analyze and real execution time
Previous Message Robert Haas 2010-11-15 19:39:03 Re: Difference between explain analyze and real execution time