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