Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5xfo-00042p-Jw for pgsql-performance@arkaria.postgresql.org; Fri, 19 Jun 2015 14:53:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z5xfo-0005ku-4p for pgsql-performance@arkaria.postgresql.org; Fri, 19 Jun 2015 14:53:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z5xfn-0005ko-Cx for pgsql-performance@postgresql.org; Fri, 19 Jun 2015 14:53:39 +0000 Received: from resqmta-ch2-01v.sys.comcast.net ([2001:558:fe21:29:69:252:207:33]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z5xfj-00082E-UU for pgsql-performance@postgresql.org; Fri, 19 Jun 2015 14:53:38 +0000 Received: from resomta-ch2-17v.sys.comcast.net ([69.252.207.113]) by resqmta-ch2-01v.sys.comcast.net with comcast id iEtH1q0092TL4Rh01EtYS2; Fri, 19 Jun 2015 14:53:32 +0000 Received: from [10.0.0.151] ([173.166.19.109]) by resomta-ch2-17v.sys.comcast.net with comcast id iEtX1q00Q2MCEZH01EtYr3; Fri, 19 Jun 2015 14:53:32 +0000 Message-ID: <55842CF7.6080007@intuvisiontech.com> Date: Fri, 19 Jun 2015 10:53:43 -0400 From: Ian Pushee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Slow query (planner insisting on using 'external merge' sort type) References: <55842859.4060102@intuvisiontech.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1434725612; bh=3W97naZ1en2bonANUG2g+DTGXJE4Ajcol4/JVLO6eWk=; h=Received:Received:Message-ID:Date:From:MIME-Version:To:Subject: Content-Type; b=DEFyoAsMwA94BXB6NgVBIH+54pSKGHPeEBaD/GW6pH161/T9MKfcx2L9fCzQfjXUV YPF7vVqljiBRJfMh6ep6LjybhNBtU4It9nGrpS9TK28wXMAoRw8Bat93buzyWdO58k 6xb5D6BMH16uHPyWtwTsX4pPugbQpMKeLJGPvq9NgcXiTU9v/IA4ur8iaqZ55u1YE1 dwHDy96TkXdRLq4aG3FNdweXeQlgoke4OcEd4e2IT5agn/SERxZRhjub9aL9yd+zOZ +X+sDqDocyMfmjt4JOi0PbFkrReocH2DZikgsHd7nWcNP9PmG2DobcWcV4Y8nvmEwV lEXYTz8UbZFHA== X-Pg-Spam-Score: -2.6 (--) 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 6/19/2015 10:46 AM, Igor Neyman wrote: > > Probably events_confidnce index is not very selective, that's why optimizer prefers seq scan. > I'd try to create an index on (name, eventspy_id, camera_id, type, status). > > Also, the recent 9.2 is 9.2.13, you should upgrade. > > Regards, > Igor Neyman Hi Igor, I already have an index for (name, eventspy_id, camera_id, type, status)... that is the index being used (apparently silently) when I set random_page_cost=1.0. Thanks, -Ian -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance