Re: Slow Query

From: 林士博 <lin(at)repica(dot)co(dot)jp>
To: robbyc <robcampbell73(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow Query
Date: 2015-08-13 09:21:23
Message-ID: CACudzGibWcux4Zy72oxD2QmeyyqPqGCP+hg3DDidGrcWt6by3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

In the 'not exists' cluster, you do not have to search table "Vacancy as v"
again.
I think it would be faster to use the outer Vacancy table as below.
In your case, that do the same work.

NOT EXISTS (
SELECT 1
FROM "CategoryOption_TableRow" "ct126"
WHERE "Vacancy"."Template"
AND "ct126"."CategoryOptionID" IN (34024,35254,35255,35256)
AND "ct126"."Category_TableID" = 126
AND "ct126"."RowID" = "Vacancy"."ID"
)

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2015-08-13 17:09:30 Strange query stalls on replica in 9.3.9
Previous Message robbyc 2015-08-13 00:50:39 Re: Slow Query