Re: [ADMIN] Not so simple query and a half million loop

2008-12-02 Thread DANIEL CRISTIAN CRUZ
Because of a Bad Model... When it is a single event egw_cal_dates always has a record with cal_start = 0. When it is a recurrent event, egw_cal_dates has a record with cal_start = 0 and a record with cal_start equal to recurrent start. With this construction it returns correctly calendar excepti

Re: [ADMIN] Not so simple query and a half million loop

2008-12-02 Thread Alvaro Herrera
Daniel Cristian Cruz escribió: > 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 = c

Re: [ADMIN] Not so simple query and a half million loop

2008-12-02 Thread Daniel Cristian Cruz
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

Re: [ADMIN] Not so simple query and a half million loop

2008-12-01 Thread Daniel Cristian Cruz
Maybe someone would like to see it without broken lines (I do). Regards, 2008/12/1 Daniel Cristian Cruz <[EMAIL PROTECTED]>: > I've tryied 4 times to post this message to pgsql-performance without > success... No return, even an error... > > Below is my problem; a query that perform bad when usin

[ADMIN] Not so simple query and a half million loop

2008-12-01 Thread Daniel Cristian Cruz
I've tryied 4 times to post this message to pgsql-performance without success... No return, even an error... Below is my problem; a query that perform bad when using a filter almost equal. The problem (8.2.11): EXPLAIN ANALYZE SELECT resource, category, userid, title, year, month, SUM(hours) FROM