Skip site navigation (1) Skip section navigation (2)

pgsql: Save a few cycles while creating "sticky" entries inpg_stat_sta

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Save a few cycles while creating "sticky" entries inpg_stat_sta
Date: 2012-04-09 15:16:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Save a few cycles while creating "sticky" entries in pg_stat_statements.

There's no need to sit there and increment the stats when we know all the
increments would be zero anyway.  The actual additions might not be very
expensive, but skipping acquisition of the spinlock seems like a good
thing.  Pushing the logic about initialization of the usage count down into
entry_alloc() allows us to do that while making the code actually simpler,
not more complex.  Expansion on a suggestion by Peter Geoghegan.



Modified Files
contrib/pg_stat_statements/pg_stat_statements.c |   81 ++++++++---------------
1 files changed, 28 insertions(+), 53 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-04-09 15:42:04
Subject: pgsql: Don't bother copying empty support arrays in a zero-columnMerge
Previous:From: Heikki LinnakangasDate: 2012-04-09 06:47:39
Subject: pgsql: Remove link to ODBCng project from the docs.

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group