Re: more execution time

Поиск
Список
Период
Сортировка
Искать
От
Richard Huxton
Тема
Re: more execution time
Дата
Msg-id
42319798.1060206@archonet.com
Ответ на
more execution time (ALÝ ÇELÝK)
Список
Дерево обсуждения
more execution time "ALÝ ÇELÝK" <ali@verus.com.tr>
Re: more execution time Richard Huxton <dev@archonet.com>
ALÝ ÇELÝK wrote:
> why this query needs more time?  Its very slow

Difficult to say for sure - could you provide the output of EXPLAIN 
ANALYSE rather than just EXPLAIN?

Some other immediate observations:
1. Perhaps don't post to so many mailing lists at once. If you reply to 
this, maybe reduce it to pgsql-performance?
2. You don't say whether the row estimates are accurate in the EXPLAIN.
3. You seem to be needlessly coalescing personaldetails.masterid since 
you check for it being null in your WHERE clause
4. Do you really need to cast to numeric and generate a "sorting" column 
that you then don't ORDER BY?
5. Is ppid an id number? And are you sure it's safe to calculate it like 
that?
6. What is balance() and how long does it take to calculate its result?

> select
>       coalesce(personaldetails.masterid::numeric,personaldetails.id) +
> (coalesce(personaldetails.id::numeric,0)/1000000) as sorting,
>       floor(coalesce(personaldetails.masterid::numeric,personaldetails.id) +
> (coalesce(personaldetails.id::numeric,0)/1000000)) as ppid,

>       balance('MASTER-REGISTRATION',personaldetails.id) as balance,

>       balance('MASTER-REGISTRATION',pd2.id) as accbalance,

I'm guessing point 6 is actually your problem - try it without the calls 
to balance() and see what that does to your timings.
--
   Richard Huxton
   Archonet Ltd
В списке pgsql-general по дате отправления
От: GIROIRE Nicolas (COFRAMI)
Дата:
Сообщение: Convert Cursor to array
От: Dick Davies
Дата:
FAQ