X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id CB7F59F9EEB for ; Sat, 20 May 2006 01:51:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26674-02 for ; Sat, 20 May 2006 01:51:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail5.sea5.speakeasy.net (mail5.sea5.speakeasy.net [69.17.117.7]) by postgresql.org (Postfix) with ESMTP id 3551D9FA3B3 for ; Sat, 20 May 2006 01:51:33 -0300 (ADT) Received: (qmail 25768 invoked from network); 20 May 2006 04:51:33 -0000 Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.20]) (davidw@[66.93.38.250]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted SMTP for ; 20 May 2006 04:51:32 -0000 Mime-Version: 1.0 (Apple Message framework v750) Content-Transfer-Encoding: 7bit Message-Id: <1D5FC47D-8D90-4856-8EB7-833476A37587@kineticode.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance From: David Wheeler Subject: Benchmarking Function Date: Fri, 19 May 2006 21:51:30 -0700 X-Mailer: Apple Mail (2.750) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/409 X-Sequence-Number: 19196 Fellow PostgreSQLers, With a bit of guidance from Klint Gore, Neil Conway, Josh Berkus, and Alexey Dvoychenkov, I have written a PL/pgSQL function to help me compare the performance between different functions that execute the same task. I've blogged the about the function here: http://www.justatheory.com/computers/databases/postgresql/ benchmarking_functions.html My question for the list is: How important is it that I have the control in there? In the version I've blogged, the control just executes 'SELECT TRUE FROM generate_series( 1, n)' and iterates loops over the results. But I wasn't sure how accurate that was. Another approach I've tried it to simply loop without executing a query, 'FOR i IN 1..n LOOP', but that takes virtually no time at all. The idea of the control is, of course, to subtract the overhead of the benchmarking function from the code actually being tested. So I guess my question is, how important is it to have the control there, and, if it is important, how should it actually work? Many TIA, David