Re: How much expensive are row level statistics?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-performance(at)postgresql(dot)org, Carlos Benkendorf <carlosbenkendorf(at)yahoo(dot)com(dot)br>
Subject: Re: How much expensive are row level statistics?
Date: 2005-12-13 01:07:51
Message-ID: 20051213010751.GA63416@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-performance

On Mon, Dec 12, 2005 at 06:01:01PM -0500, Tom Lane wrote:
> IIRC, the only significant cost from enabling stats is the cost of
> transmitting the counts to the stats collector, which is a cost
> basically paid once at each transaction commit. So short transactions
> will definitely have more overhead than longer ones. Even for a really
> simple transaction, though, 30% seems high --- the stats code is
> designed deliberately to minimize the penalty.

Now there goes Tom with his skeptical eye again, and here comes me
saying "oops" again. Further tests show that for this application
the killer is stats_command_string, not stats_block_level or
stats_row_level. Here are timings for the same set of operations
(thousands of insert, update, and delete statements in one transaction)
run under various settings:

stats_command_string = off
stats_block_level = off
stats_row_level = off
time: 2:09.46

stats_command_string = off
stats_block_level = on
stats_row_level = off
time: 2:12.28

stats_command_string = off
stats_block_level = on
stats_row_level = on
time: 2:14.38

stats_command_string = on
stats_block_level = off
stats_row_level = off
time: 2:50.58

stats_command_string = on
stats_block_level = on
stats_row_level = on
time: 2:53.76

[Wanders off, swearing that he ran these tests before and saw higher
penalties for block- and row-level statistics.]

--
Michael Fuhr

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Qingqing Zhou 2005-12-13 01:08:47 Re: Which qsort is used
Previous Message Neil Conway 2005-12-13 01:02:00 Re: Anyone for adding -fwrapv to our standard CFLAGS?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-12-13 03:20:45 Re: How much expensive are row level statistics?
Previous Message Neil Conway 2005-12-13 00:22:20 Re: TODO item: list prepared queries

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-12-13 03:20:45 Re: How much expensive are row level statistics?
Previous Message J. Andrew Rogers 2005-12-12 23:17:50 Re: opinion on disk speed