Re: Confirmation of bad query plan generated by 7.4

Поиск
Список
Период
Сортировка
От Shaun Thomas
Тема Re: Confirmation of bad query plan generated by 7.4
Дата
Msg-id 448EF8B2.8F27.00A9.0@leapfrogonline.com
обсуждение исходный текст
Ответ на Re: Confirmation of bad query plan generated by 7.4  ("Jim C. Nasby" <jnasby@pervasive.com>)
Ответы Re: Confirmation of bad query plan generated by 7.4  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: Confirmation of bad query plan generated by 7.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Confirmation of bad query plan generated by 7.4  ("Shaun Thomas" <sthomas@leapfrogonline.com>)
Список pgsql-performance
>>> On 6/13/2006 at 4:54 PM, "Jim C. Nasby" <jnasby@pervasive.com>
wrote:

> SELECT attname, attstattarget
>     FROM pg_attribute
>     WHERE attrelid='table_name'::regclass AND attnum >= 0;

-1 for all values.

> SHOW default_statistics_target;

10.

Here's something slightly annoying: I tried precalculating the value
in my stored proc, and it's still ignoring it.

lastTime := now() - interval ''7 days'';

UPDATE fact_credit_app
   SET activated_date_id = ad.date_id
  FROM l_event_log e
  JOIN c_event_type t ON (t.id = e.event_type_id)
  JOIN wf_date ad ON (e.event_date::date=ad.datestamp)
 WHERE e.ext_id=fact_credit_app.unique_id
   AND t.event_name = ''activation''
   AND e.event_date > lastTime
   AND fact_credit_app.activated_date_id IS NULL;

Instead of taking a handful of seconds (like when I replace
lastTime with the text equivalent), it takes 10 minutes...
I can see the planner not liking the results of a function,
but a variable?  That's a static value!  ::cry::


--

Shaun Thomas
Database Administrator

Leapfrog Online
807 Greenwood Street
Evanston, IL 60201
Tel. 847-440-8253
Fax. 847-570-5750
www.leapfrogonline.com


Confidentiality Note:

The document(s) accompanying this e-mail transmission, if any, and the
e-mail transmittal message contain information from Leapfrog Online
Customer Acquisition, LLC is confidential or privileged. The information
is intended to be for the use of the individual(s) or entity(ies) named
on this e-mail transmission message. If you are not the intended
recipient, be aware that any disclosure, copying, distribution or use of
the contents of this e-mail is prohibited. If you have received this
e-mail in error, please immediately delete this e-mail and notify us by
telephone of the error

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Confirmation of bad query plan generated by 7.4
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: scaling up postgres