Query takes too long to run

Поиск
Список
Период
Сортировка
От Devinder K Rajput
Тема Query takes too long to run
Дата
Msg-id OF2BFCAFEF.5AC8B24E-ON86256C4B.0079E490@ipaper.com
обсуждение исходный текст
Список pgsql-admin
Hi all,

I am running the following query.  It processes most of the locations fine
($Req_Store), however, on one of the locations, it takes almost 3 days to
run when it should take only about a half hour. (The query is rerun for
each location ($Req_Store)).

$result = $conn->exec("
    declare my_cursor cursor for
    select
     invt_store,
    <snip>
    g.minmindays
    from dioh_iminvf_inventory a,
         dioh_imitmf_itemmaster b,
         dioh_imvitf_vendoritem c,
         dioh_samohf_saleshistory d,
         dioh_leaddays_loc f,
         dioh_rank g,
         dioh_rankcategory h
    where
         h.cp_item_cat = item_cat
      and
         g.rankid = h.rankid
      and
         g.rank = invt_rank
      and
         a.invt_store = '$Req_Store'
      and
         f.lead_store = '$Req_Store'
      and
         f.lead_vendno = c.vitm_vendno
      and
         (a.invt_store,a.invt_itemno) = (d.slht_store,d.slht_itemno)
      and
         b.item_itemno = a.invt_itemno
      and
         (b.item_itemno,b.item_vendno) = (c.vitm_itemno,c.vitm_vendno)
      and
         d.slht_monthid between $FromMonthId and $ToMonthId
    order by invt_store, invt_itemno, slht_monthid
    ;
");

I setup logging by setting up:
     debug_level = 2 # range 0-16
     debug_print_query = true
     debug_pretty_print = true

I get the following message about every 15 fifteen minutes in log file and
postmaster is using up close to 99% of the CPU.
DEBUG:  proc_exit(0)
DEBUG:  shmem_exit(0)
DEBUG:  exit(0)
/usr/bin/postmaster: reaping dead processes...
/usr/bin/postmaster: CleanupProc: pid 22128 exited with status 0

Any ideas on what is going on.  Thank you for your help.

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



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

Предыдущее
От: Hubert depesz Lubaczewski
Дата:
Сообщение: Re: Fast Deletion For Large Tables
Следующее
От: Rafal Kedziorski
Дата:
Сообщение: Debug information