Fwd: Not so simple query and a half million loop

From: "Daniel Cristian Cruz" <danielcristian(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Fwd: Not so simple query and a half million loop
Date: 2008-12-02 16:02:35
Message-ID: 48d0cacb0812020802t1ae88fcfse12f2526ab1c993b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

Hi, all!

No one knows why I got "actual time=0.014..0.570 rows=30 loops=511222"
and "actual time=0.005..0.006 rows=1 loops=15158976"?

With:
cu.cal_user_type = 'u' AND
cu.cal_recur_date = COALESCE((SELECT cd.cal_start FROM egw_cal_dates
icd WHERE icd.cal_id = cd.cal_id AND icd.cal_start = cd.cal_start AND
icd.cal_start <> 0), 0)
~ 450 seconds

With
cu.cal_user_type = 'u'
~ 130 ms

With
cu.cal_recur_date = COALESCE((SELECT cd.cal_start FROM egw_cal_dates
icd WHERE icd.cal_id = cd.cal_id AND icd.cal_start = cd.cal_start AND
icd.cal_start <> 0), 0)
~ 1 second

I've tryied to increase statistics to maximum, with no success.

This is the eGroupware database schema, with a few records.

The complete queries and plan folows.

---------- Forwarded message ----------
From: Daniel Cristian Cruz <danielcristian(at)gmail(dot)com>
Date: 2008/12/1
Subject: Not so simple query and a half million loop
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>

I've tryied 4 times to post this message to pgsql-performance without
success... No return, even an error...

--
Daniel Cristian Cruz
クルズ クリスチアン ダニエル

Attachment Content-Type Size
query.sql application/octet-stream 28.9 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-02 16:07:37 Re: Not so simple query and a half million loop
Previous Message Isabella Ghiurea 2008-12-02 15:52:04 Re: change user passwd

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-02 16:07:37 Re: Not so simple query and a half million loop
Previous Message Andrus 2008-12-02 15:50:53 Re: analyzing intermediate query