Re: pgbench - refactor init functions with buffers

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Steele <david@pgmasters.net>, Alvaro Herrera <alvherre@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>, Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-10-02T08:55:40Z
Lists: pgsql-hackers
> Can you elaborate what you meant by the new "print overheads should probably 
> be avoided" comment?

Because printf is slow and this is on the critical path of data 
generation. Printf has to interpret the format each time just to print 
three ints, specialized functions could be used which would allow to skip 
the repeated format parsing.

> I left that out since it seems unrelated to switching to PQExpBuffer.

Yep.

Thanks for the commit. Getting rid of most snprintf is a relief.

-- 
Fabien.



Commits

  1. pgbench: Use PQExpBuffer to simplify code that constructs SQL.

  2. Make command order in test more sensible