Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFPZm-00083U-Sn for pgsql-performance@arkaria.postgresql.org; Tue, 12 Mar 2013 13:49:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UFPZm-00014n-78 for pgsql-performance@arkaria.postgresql.org; Tue, 12 Mar 2013 13:49:10 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFPZl-00014i-C3 for pgsql-performance@postgresql.org; Tue, 12 Mar 2013 13:49:09 +0000 Received: from smtp.peak6.com ([38.98.137.6]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFPZj-000807-3W for pgsql-performance@postgresql.org; Tue, 12 Mar 2013 13:49:08 +0000 X-AuditID: 0a64cb20-b7faa6d000002bfd-e6-513f32511a8e Message-ID: <513F3250.2050208@optionshouse.com> Date: Tue, 12 Mar 2013 08:49:04 -0500 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Tom Lane CC: "pgsql-performance@postgresql.org" Subject: Re: Slow query when used in a view References: <513E5AB9.4010809@optionshouse.com> <1454.1363046219@sss.pgh.pa.us> In-Reply-To: <1454.1363046219@sss.pgh.pa.us> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCIsWRmVeSWpSXmKPExsXClcIrphtoZB9osGGZmsX1meeYLU6tusvk wORxYd80do9FzzayBDBFNTDaJObl5ZcklqQqpKQWJ9sq+ReUZObnFXvklxanKrhkFifnJGbm phYpKWSm2CoZKykU5CQmp+am5pXYKiUWFKTmpSjZcSlgABugssw8hdS85PyUzLx0WyXPYH9d CwtTS11DJbt4ZJDQyZLR/m0va0EDa8WDsxENjD+Yuxg5OSQETCRm7t7CDmGLSVy4t56ti5GD g1dAX+LJogSQMIuAqsSerevBStgEdCUm9a9gA7GFBFQk+s7eYAKx+QWEJfZ9aAIbKSoQJvFy yQ6wGl4BQYmTM5+wgNgiAgoSfQ/egc1hFvCU6Di1ihHEFhYwldhwdhMjxEx/iRWLprGC2JwC OhK3rn5hhKi3lbgw5zoLhC0vsf3tHGaIelWJFc0T2SDOV5D4f+Ud0wRGoVlIVs9C0j4LSfsC RuZVjOLFZYnJGZmmBcW5JQVGegWpidlmenmpJZsYwVF7WmEH4/dOq0OMAhyMSjy8E3jtAoVY E8uKK3MPMUpwMCuJ8GZsBgrxpiRWVqUW5ccXleakFh9i9AGG2URmKdHkfGBCySuJNzQ2NTC1 NDU0NTc1NMIhrCTOyxxjFSgkkA5MI9mpqQWpRTDjmDg4pRoYj8SZ/5ifnZj5Vux0SvE+w2nZ lb8z/r8Pd5fLlF8n0WDU0Gi77Pqi2/VSFzJPBZy+vzh1lrh6xXEJ69VfNv+IMOx5tNT83sOn mUXm8a67bz2+p69bez7t79oqT57ZD9qnTjo8p0E3wSJ507nZuxRqdZ74dzOsS1t/3N3mye53 KUda1/obsBrOU2Ipzkg01GIuKk4EAJGhwKMHAwAA X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 03/11/2013 06:56 PM, Tom Lane wrote: > And that means that you get the inefficient plan wherein the > foo-to-tiny_foo join is computed in its entirety. :( That's unfortunate, though I guess it makes sense. I moved the join in the view into the SELECT clause as an EXISTS, and that seems to work without major adverse effects. Apparently the tiny table really will be tiny in actual use, so impact should be minimal. I just really don't like using subselects that way. :) Thanks, Tom! -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-676-8870 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance