Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 9912D1574110 for ; Sun, 1 Jan 2012 14:59:40 -0400 (AST) Received: from mail-qw0-f53.google.com ([209.85.216.53]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RhQdA-0005xz-ED for pgsql-performance@postgresql.org; Sun, 01 Jan 2012 18:59:40 +0000 Received: by qadb15 with SMTP id b15so10057747qad.19 for ; Sun, 01 Jan 2012 10:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=zWvh3cGQkunA9wQQ8ROOJdbbNiymrnn+VLtXr+qqSpI=; b=JB7xGbGiRNTaHSJAq+oY9xJ24zSM7k4z5h5mSs0wHJ2G1XqvoGI4/0wHFqOgLH5J5c 9Vsowm3UvNuA+6lxebL9NcxnSPW14pLHXQPY7GcEyWGiD01ExLvZAIplEo3HD2NgPc03 EOEoUbYNROKIM8bronm35i0GtwQ7sChrDUFQM= Received: by 10.224.39.81 with SMTP id f17mr55062045qae.63.1325444367826; Sun, 01 Jan 2012 10:59:27 -0800 (PST) Received: from speedbook-air.home.jay.fm (home.jay.fm. [173.166.48.118]) by mx.google.com with ESMTPS id z1sm87624209qao.1.2012.01.01.10.59.27 (version=SSLv3 cipher=OTHER); Sun, 01 Jan 2012 10:59:27 -0800 (PST) Message-ID: <4F00AD0D.6000501@gmail.com> Date: Sun, 01 Jan 2012 13:59:25 -0500 From: Jay Levitt User-Agent: Postbox 3.0.2 (Macintosh/20111203) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Cost estimate vs. actual - do I care? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201201/1 X-Sequence-Number: 46014 I gather that a big part of making queries performant is making sure the planner's estimates reflect reality. Given a random explain analyze line: Limit (cost=0.02..943.11 rows=50 width=16) (actual time=0.603..79.729 rows=50 loops=1) which is the truer statement? 1. As long as costs go up with actual time, you're fine. 2. You should try to ensure that costs go up linearly with actual time. 3. You should try to ensure that costs are as close as possible to actual time. 4. The number "4". Jay Levitt