Re: Not so simple query and a half million loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 exceptions...

It's somewhat complex but it returns slowly ok.

Regards,

"Alvaro Herrera" <alvherre@xxxxxxxxxxxxxxxxx> escreveu:
> 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 = cd.cal_id AND icd.cal_start = cd.cal_start AND
>> icd.cal_start <> 0), 0)
>>  ~ 450 seconds
> 
> I don't know, but why are you using such an expression instead of an
> outer join?
> 
> -- 
> Alvaro Herrera                               
http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
> 
> -- 
> Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
> 

--
<span style="color: #000080">Daniel Cristian Cruz
</span>Administrador de Banco de Dados
Direção Regional - Núcleo de Tecnologia da Informação
SENAI - SC
Telefone: 48-3239-1422 (ramal 1422)




-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux