Slow when joining with view

From: Kiswono Prayogo <kiswono(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Slow when joining with view
Date: 2015-06-16 08:10:28
Message-ID: CANiF8TQvHGKkkmrLTX1KRzf8hr5bOvgLGqZhmiKETE5xaXvTEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

The case
https://stackoverflow.com/questions/30861967/slow-when-joining-with-view

It doesn't make sense that this query took 10*s*:

explain analyzeSELECT x1.id FROM (
SELECT id, data->>'open_course_id' oc_id
FROM student_credits
WHERE (data->>'student_id')::BIGINT = '5500') x1JOIN (
SELECT id FROM V_OpenCourse_WithTC
WHERE semester_id = '53') x2 ON x1.oc_id::BIGINT = x2.id

when both of its components took less than 100*ms*:

SELECT id, data->>'open_course_id' oc_id
FROM student_credits
WHERE (data->>'student_id')::BIGINT = '5500'

SELECT id FROM V_OpenCourse_WithTC
WHERE semester_id = '53'

--
Best Regards,
Kiswono P
GB

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ankur Kaushik 2015-06-17 08:58:29 Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"
Previous Message Albe Laurenz 2015-06-15 16:01:13 Re: ERROR: duplicate key value violates unique constraint "geocode_settings_pkey"