Re: Consecutive Query Executions with Increasing Execution Time

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nicolas Charles <nicolas(dot)charles(at)normation(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org, Peter Geoghegan <pg(at)bowt(dot)ie>, Shijia Wei <shijiawei(at)utexas(dot)edu>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: Consecutive Query Executions with Increasing Execution Time
Date: 2019-12-17 04:04:45
Message-ID: 20191217040445.rles4rzbcpa52khw@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

On 2019-12-16 17:48:16 -0500, Tom Lane wrote:
> Hmm, that's an interesting thought. The OP did say the CPU type,
> but according to Intel's spec page for it [1] the difference between
> base and turbo frequency is only 4.0 vs 4.2 GHz, which doesn't seem
> like enough to explain the results ... unless you suppose it actually
> throttled to below base freq, which surely shouldn't happen that fast.
> Might be worth watching the CPU frequency while doing the test though.

FWIW, it takes about 3s for my laptop CPU to throttle way below
non-turbo when I put it under strenuous load. Obviously that's a laptop,
and caused by a firmware bug leading to fans not spinning fast enough
automatically. But it'd not take that much for insufficient cooling to
cause problems in a desktop either. Been there, done that.

But: I don't see that causing a 10x slowdown as reported in the first
mail in this thread.

I think we need a system-wide perf profile during a few initial "good"
runs and then later from a few "really bad" runs. For that you'd have to
make sure you compiled postgres with debug symbols (--enable-debug to
configure), and then run something like
perf record -o fast.data --call-graph dwarf -a sleep 3
while running repeated "fast" queries and then
perf record -o slow.data --call-graph dwarf -a sleep 3

and then show us the results of something like
perf report -i fast.data -g folded --percent-limit 1 > fast.txt
perf report -i slow.data -g folded --percent-limit 1 > slow.txt

and also, if your perf is new enough:
perf diff fast.data slow.data > diff.txt

- Andres

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2019-12-17 11:08:33 Re: weird long time query
Previous Message Kaijiang Chen 2019-12-17 02:58:17 weird long time query