Re: Not so simple query and a half million loop

Поиск
Список
Период
Сортировка
От DANIEL CRISTIAN CRUZ
Тема Re: Not so simple query and a half million loop
Дата
Msg-id b1955054813e88a132ce7a1edba1bc79@intranet.sc.senai.br
обсуждение исходный текст
Ответ на Re: Not so simple query and a half million loop  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-admin
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@commandprompt.com> 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@postgresql.org)
> 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)




В списке pgsql-admin по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Not so simple query and a half million loop
Следующее
От: Chris Browne
Дата:
Сообщение: Re: change user passwd