Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vx12n-0000e7-IV for pgsql-performance@arkaria.postgresql.org; Sat, 28 Dec 2013 21:03:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vx12m-000454-LJ for pgsql-performance@arkaria.postgresql.org; Sat, 28 Dec 2013 21:03:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vx12k-00044v-2y for pgsql-performance@postgresql.org; Sat, 28 Dec 2013 21:03:34 +0000 Received: from nm22-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.182]) by magus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vx12g-0004mn-G9 for pgsql-performance@postgresql.org; Sat, 28 Dec 2013 21:03:33 +0000 Received: from [98.138.226.180] by nm22.bullet.mail.ne1.yahoo.com with NNFMP; 28 Dec 2013 21:03:28 -0000 Received: from [98.138.226.168] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 28 Dec 2013 21:03:28 -0000 Received: from [127.0.0.1] by omp1069.mail.ne1.yahoo.com with NNFMP; 28 Dec 2013 21:03:28 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 253612.47853.bm@omp1069.mail.ne1.yahoo.com Received: (qmail 99085 invoked by uid 60001); 28 Dec 2013 21:03:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1388264608; bh=aenLvNV97Tb1auXgk036ptdvC48MqNKq5FVRImkOLJM=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ninHi46BYJvfDGklLF405J6Cd3UFuHxCnM6LctrwrBqwMPGWvS2PPBkMyvKM7eKwKphhYLg3bVOg9NcDFCF57/OS1tJy+/F2HhYUxoTynuICc8N0wqH2yrIrVV5ylpUs61s0UUyta/YgBbEnBTONZKAlNn2Re8lnd5xLNgayvW0= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0BsteklTHYmXNzRpjnkDvPI2Iht7reeRvGCLTm4TfGyBVMFKOvOOytbbqXdCB3lxy3lMj/FcLrl0U0Q792hAJ6t3NvvgcVrWQrIDXwDED4B+qZ2SmR/rbBcF7VyQQk1sdK6oWIJo6ld51dNHtQ8O0Kb0UzNnC70ObK5H+6TMtq8=; X-YMail-OSG: XaBRn0wVM1lu9GfUMdNPhu0TzffZc4tQmdaMpc7cQbO9vke EOY9nRQZ5Bb63bOKlgTjbYn3XBMPyH3lAE7SqzfNPvfb9GdVZ_hWnh6UEt3E 4gJiqBHKeGOjh1akzmL4UKvMQHO7b_P4Tdt3Zsuzk1IpTvJ1Yl2FkkAZX3a_ _BlPPC4g_NXkXpZ8SaYRr.cVWsBna2QUsh18N7efRTPpaXNwTTOrPrEmGUu5 GXJhTXPo_nD42lgS.Lc3PqC2OupgHw3ybPFZ.d70UuB83sr6U3u48XHgwihs V1nbIMsDxGaeK5essY1ZRfZQPoxVrP4sxEF5DHYIsmrCwhgHFL5uIiiaKuiL wYGSCgCyhQOi3sQHKVtT0zedC2MiWhGc0i.oyfHRyYjv28D36Jm7XbwCx8hs waRUo6xgU8_uwTBmGrYpIQ9Cltihxhle.nOSS9nPvR_40iNvTXsUwVGj8zHM jmKyTNBZfr9f9wD4qGTsZLbYA1s_9.0hnoCl3DI4HSKg4IqU._kY3ZCsNkFI elV2KZAR4YLL.MqP0EpFn0us5Xfwstm8cFpqX6IcLSdL4uwo08lwpJ3Bj4U7 enSRGaEKH2kS1Vok38UBA6trwfkADN24tGsB_olo- Received: from [76.255.18.237] by web122306.mail.ne1.yahoo.com via HTTP; Sat, 28 Dec 2013 13:03:28 PST X-Rocket-MIMEInfo: 002.001, TWljaGFlbCBLb2xvbWVpdHNldiA8bWtvbG9tZWl0c2V2QGdtYWlsLmNvbT4gd3JvdGU6Cgo.IGl0IGlzIGNsZWFyIGZvciBtZSB3aHkgdDFfYl9hX2lkeCBpcyBiZXR0ZXIuIFRoZSBxdWVzdGlvbiBpczogSXMKPiBwb3N0Z3Jlc3FsIGFibGUgdG8gc2VlIHRoYXQ_CgpGb3IgYSBudW1iZXIgb2YgcmVhc29ucyBJIG5ldmVyIGNvbnNpZGVyIGEgYnVsayBsb2FkIGNvbXBsZXRlIHVudGlsCkkgcnVuIFZBQ1VVTSBGUkVFWkUgQU5BTFlaRSBvbiB0aGUgdGFibGUocykgaW52b2x2ZWQuwqAgV2hlbiBJIHRyeQp5b3UBMAEBAQE- X-Mailer: YahooMailWebService/0.8.172.614 References: Message-ID: <1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.com> Date: Sat, 28 Dec 2013 13:03:28 -0800 (PST) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: Pg makes nonoptimal choice between two multicolumn indexes with the same columns but in different order. To: Michael Kolomeitsev , "pgsql-performance@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) 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 Michael Kolomeitsev wrote: > it is clear for me why t1_b_a_idx is better. The question is: Is > postgresql able to see that? For a number of reasons I never consider a bulk load complete until I run VACUUM FREEZE ANALYZE on the table(s) involved.=A0 When I try your test case without that, I get the bad index choice.=A0 When I then run VACUUM FREEZE ANALYZE on the database I get the good index choice. There may be some lesser maintenance which sets up visibility information and provides the planner with enough data to make a good choice, I just noticed that you were not following what I consider to be rote good practice, tried it, and it solved the problem. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance