From:
Greg Stark <gsstark(at)mit(dot)edu>
To:
Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
Cc:
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bart Samwel <bart(at)samwel(dot)tk>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject:
Re: Avoiding bad prepared-statement plans.
Date:
2010-02-16 14:22:00
Message-ID:
407d949e1002160622l65719aabpf68165681ee8b6be@mail.gmail.com (view raw or flat )
Thread:
2010-02-09 12:08:54 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-09 12:59:15 from Yeb Havinga <yebhavinga(at)gmail(dot)com>
2010-02-09 13:46:55 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-09 14:53:17 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-10 00:47:18 from Kris Jurka <books(at)ejurka(dot)com>
2010-02-11 03:12:41 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-11 04:07:57 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-09 22:21:43 from Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
2010-02-09 13:50:32 from Richard Huxton <dev(at)archonet(dot)com>
2010-02-09 14:25:19 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-09 14:45:57 from Richard Huxton <dev(at)archonet(dot)com>
2010-02-09 14:10:22 from Andres Freund <andres(at)anarazel(dot)de>
2010-02-09 14:28:01 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-09 16:43:52 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-09 16:59:41 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-11 03:15:01 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-11 06:26:15 from Дмитрий Фефелов <fozzy(at)ac-sw(dot)com>
2010-02-11 12:09:33 from Bart Samwel <bart(at)samwel(dot)tk>
2010-02-11 12:25:28 from Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
2010-02-11 12:39:49 from Bart Samwel <bart(at)samwel(dot)tk>
2010-02-11 12:41:12 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-11 12:48:14 from Bart Samwel <bart(at)samwel(dot)tk>
2010-02-11 13:04:46 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-11 16:17:40 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-11 16:39:11 from Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
2010-02-15 19:11:34 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-15 20:03:21 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-15 20:05:29 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-16 14:28:57 from Greg Stark <gsstark(at)mit(dot)edu>
2010-02-16 14:31:44 from Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
2010-02-16 20:17:32 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-17 03:12:50 from Greg Stark <gsstark(at)mit(dot)edu>
2010-02-15 19:51:26 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-16 14:22:00 from Greg Stark <gsstark(at)mit(dot)edu>
2010-02-17 22:52:14 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-21 12:37:50 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 02:48:05 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-26 03:19:21 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 03:40:35 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 04:01:14 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 04:25:46 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-28 14:12:32 from Greg Stark <gsstark(at)mit(dot)edu>
2010-02-26 04:28:14 from Alex Hunsaker <badalex(at)gmail(dot)com>
2010-02-26 04:46:20 from Alex Hunsaker <badalex(at)gmail(dot)com>
2010-02-26 05:11:56 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 06:29:41 from Alex Hunsaker <badalex(at)gmail(dot)com>
2010-02-26 15:07:00 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 15:27:30 from Alex Hunsaker <badalex(at)gmail(dot)com>
2010-02-26 16:51:53 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 18:11:44 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 16:50:37 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 20:02:40 from Alex Hunsaker <badalex(at)gmail(dot)com>
2010-02-26 08:13:31 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 10:20:17 from Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
2010-02-26 14:49:35 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 16:27:11 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 16:54:10 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 17:01:59 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 20:11:16 from Yeb Havinga <yebhavinga(at)gmail(dot)com>
2010-02-26 20:29:11 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 20:46:27 from Yeb Havinga <yebhavinga(at)gmail(dot)com>
2010-02-26 22:40:06 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-27 00:03:06 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-27 00:50:11 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-28 01:01:43 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-28 04:22:00 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-03-01 02:47:38 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-26 18:53:38 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 18:59:22 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 19:22:37 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 19:57:56 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 20:26:05 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-02-26 20:47:55 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2010-02-26 19:23:22 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-03-01 11:18:01 from Yeb Havinga <yebhavinga(at)gmail(dot)com>
2010-02-28 04:20:38 from Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
2010-02-28 07:52:55 from Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
2010-03-01 02:51:14 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-03-02 23:54:28 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-03-03 05:13:46 from Robert Haas <robertmhaas(at)gmail(dot)com>
2010-02-28 08:18:26 from Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
2010-03-02 23:53:56 from Bruce Momjian <bruce(at)momjian(dot)us>
2010-02-18 14:58:25 from "Pierre C" <lists(at)peufeu(dot)com>
2010-02-18 15:09:42 from Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
2010-02-18 16:47:01 from "Pierre C" <lists(at)peufeu(dot)com>
2010-02-18 16:54:31 from Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
2010-02-18 20:19:21 from "Pierre C" <lists(at)peufeu(dot)com>
2010-02-19 02:31:05 from David Christensen <david(at)endpoint(dot)com>
2010-02-19 13:57:51 from Kenneth Marshall <ktm(at)rice(dot)edu>
2010-02-19 17:56:12 from Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
2010-02-11 13:41:02 from Yeb Havinga <yebhavinga(at)gmail(dot)com>
Lists:
pgsql-hackers
On Mon, Feb 15, 2010 at 7:51 PM, Jeroen Vermeulen <jtv(at)xs4all(dot)nl> wrote:
> AFAIC a statement could go to "re-planning mode" if the shortest execution
> time for the generic plan takes at least 10x longer than the longest
> planning time. That gives us a decent shot at finding statements where
> re-planning is a safe bet. A parameter that we or the user would have to
> tweak would just be a fragile approximation of that.
So in principle I agree with this idea. I think a conservative value
for the constant would be more like 100x though. If I told you we had
an easy way to speed all your queries up by 10% by caching queries but
were just choosing not to then I think you would be unhappy. Whereas
if I told you we were spending 1% of the run-time planning queries I
think most people would not be concerned.
There's a second problem though. We don't actually know how long any
given query is going to take to plan or execute. We could just
remember how long it took to plan and execute last time or how long it
took to plan last time and the average execution time since we cached
that plan. Perhaps we should track the stddev of the execution plan,
or the max execution time of the plan? Ie there are still unanswered
questions about the precise heuristic to use but I bet we can come up
with something reasonable.
--
greg
In response to
Responses
pgsql-hackers by date
Next :From: Greg StarkDate: 2010-02-16 14:28:57
Subject : Re: Avoiding bad prepared-statement plans.
Previous :From : Alvaro HerreraDate : 2010-02-16 14:10:50
Subject : Re: Problem with 8.4 stats collector high load