X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 94CEE9DD597 for ; Mon, 12 Dec 2005 19:01:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45812-02 for ; Mon, 12 Dec 2005 19:01:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4E02E9DD5E6 for ; Mon, 12 Dec 2005 19:00:59 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBCN11Dh002507; Mon, 12 Dec 2005 18:01:01 -0500 (EST) To: "Merlin Moncure" cc: "Michael Fuhr" , pgsql-performance@postgresql.org, "Carlos Benkendorf" Subject: Re: How much expensive are row level statistics? In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Mon, 12 Dec 2005 13:33:27 -0500" Date: Mon, 12 Dec 2005 18:01:01 -0500 Message-ID: <2506.1134428461@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/304 X-Sequence-Number: 16125 "Merlin Moncure" writes: >> The cost depends on your usage patterns. I did tests with one of >> my applications and saw no significant performance difference for >> simple selects, but a series of insert/update/delete operations ran >> about 30% slower when block- and row-level statistics were enabled >> versus when the statistics collector was disabled. > That approximately confirms my results, except that the penalty may even > be a little bit higher in the worst-case scenario. Row level stats hit > the hardest if you are doing 1 row at a time operations over a > persistent connection. 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. regards, tom lane