pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Cristian Cruz <danielcristian@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Common slow query reasons - help with a special log
Date: Sat, 10 Dec 2011 23:27:18 -0200
Message-ID: <CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com> (raw)
In-Reply-To: <4EE3F060.6000602@fuzzy.cz>
References: <CACffM9E1d9bR=xdWYoAPF2Y2NMpfE4gpRQf6vjV3QXQ5SSSLbw@mail.gmail.com>
	<4EE39620.5020703@fuzzy.cz>
	<CACffM9HcN8JY+e7O_NXTT84Oi_YHubU1_d1obpTHzBUUPotL-Q@mail.gmail.com>
	<4EE3F060.6000602@fuzzy.cz>

2011/12/10 Tomas Vondra <tv@fuzzy.cz>

> On 10.12.2011 23:40, Daniel Cristian Cruz wrote:
> > At work we have a 24 cores server, with a load average around 2.5.
>
> A single query is processes by a single CPU, so even if the system is
> not busy a single query may hit CPU bottleneck. The real issue is the
> instrumentation overhead - timing etc. On some systems (with slow
> gettimeofday) this may be a significant problem as the query hits the
> CPU boundary sooner.
>

Yes, I forgot it will run on the same PID. Since analyze will cause all
queries to slow down, maybe the 24 cores could became overloaded.


>
> > I don't know yet if a system which use some unused CPU to minimize the
> > load of a bad query identified early is bad or worse.
>
> Not really, due to the "single query / single CPU" rule.


I guess it will be a nice tool to run in the validation server.


> > Indeed, I don't know if my boss would let me test this at production
> > too, but it could be good to know how things work in "auto-pilot" mode.
>
> What I was pointing out is that you probably should not enable loggin
> "explain analyze" output by "auto_explain.log_analyze = true". There are
> three levels of detail:
>
> 1) basic, just log_min_duration_statement
>
> 2) auto_explain, without 'analyze' - just explain plain
>
> 3) auto_explain, with 'analyze' - explain plan with actual values
>
> Levels (1) and (2) are quite safe (unless the minimum execution time is
> too low).
>

I would start with 5 seconds.

Reading the manual again and I saw that enabling analyze, it analyze all
queries, even the ones that wasn't 5 second slower. And understood that
there is no way to disable for slower queries, since there is no way to
know it before it ends...

I read Bruce blog about some features going to multi-core. Could explain
analyze go multi-core too?

Another thing I saw is that I almost never look at times in explain
analyze. I always look for rows divergence and methods used for scan and
joins when looking for something to get better performance.

I had the nasty idea of putting a // before de gettimeofday in the code for
explain analyze (I guess it could be very more complicated than this).

Sure, its ugly, but I think it could be an option for an explain analyze
"with no time", and in concept, it's what I'm looking for.

-- 
Daniel Cristian Cruz
クルズ クリスチアン ダニエル

view thread (7+ messages)  latest in thread

Message-ID: <CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com>
Permalink:  ../CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com/
Also on:    postgresql.org/message-id/CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: danielcristian@gmail.com
  Subject: Re: Common slow query reasons - help with a special log
  In-Reply-To: <CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com>
  References: <CACffM9E1d9bR=xdWYoAPF2Y2NMpfE4gpRQf6vjV3QXQ5SSSLbw@mail.gmail.com> <4EE39620.5020703@fuzzy.cz> <CACffM9HcN8JY+e7O_NXTT84Oi_YHubU1_d1obpTHzBUUPotL-Q@mail.gmail.com> <4EE3F060.6000602@fuzzy.cz> <CACffM9F4JwWjE0wqkNqPrRdEPXMdbUsUnvGL8-Rq2xiZx289TQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox