Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktG1s-000530-Q3 for pgsql-general@arkaria.postgresql.org; Sat, 26 Dec 2020 20:19:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ktG1L-0005uL-47 for pgsql-general@arkaria.postgresql.org; Sat, 26 Dec 2020 20:18:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktG1K-0005uD-7V for pgsql-general@lists.postgresql.org; Sat, 26 Dec 2020 20:18:34 +0000 Received: from sonic308-2.consmr.mail.bf2.yahoo.com ([74.6.130.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ktG1D-0007iz-Jc for pgsql-general@postgresql.org; Sat, 26 Dec 2020 20:18:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609013904; bh=fTBUo44fX0rm6VUNfsCUOMP6lE9jU1bJhVR2PYFna7E=; h=Date:From:To:Subject:References:From:Subject; b=VzWkMg9hM608pEg/Bzhy5hH/eAN2/hBE9//zn9yPXbJ51PyXRINpXuwbhVhTEzv7of/jXzKKPXjidaq/9ZWOfaOdkl+rN/BDE5D32LnaQ5vCyAh3I/J64ZhYc/JvsVQMZGJo7alAeQckkdh4YZK2sc9WX6BF8EVfDzCpioDf1m9ba//we/NzpnwbeeMxv+fYYNfYipE7nlkznkBoh/AiG7Hvuv0JarNz/uSy/7vLPl0RpsICxr2gb+zPke8SdxfV4QJf2hd5BRMdnnHU451JETkYm7QqB8AdWUhBV0gZ5AoGKKZQYb2cH+kSlRMKnVLV08RfcykUyNloWBjo69Warw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609013904; bh=p4yIj8bjEylAFCkRuVa2q8xOJgyHvCqIXs+B7UhzHEd=; h=Date:From:To:Subject:From:Subject; b=HvNGjjK7Q9jH609GCZNPOjXBAOqSn+7RmKyzHU70PAKbpXF5ZT69aWN0zUC2201PKXK5NN1UsZUir6Juv0N4Wd1Eip87JZ+tSZN9+zl2FkrveY++POf5gjmwASXnD7OCcHWUp34PkLpIeNDmiT4zgdoCezsIrFVLYh7QbJzzIaRYuxsagVeg63Anb+TDpjyib6H3WvDayXYNuk7v6fqWM/0i9dNmGTOaN6InQzh10DTmRt3BI3aTScsmk3InKOIB8BrGL9nfAGAz8h49QExcBjHl1LQMb92aeZDQA68EMouSGj6+4X1XC+5cnrYyHG36uJvJKIYDzDIOmhCyb692Aw== X-YMail-OSG: WjJ.60AVM1kUmwkVRAF3hI9ech3Y7qP_y4ItzWlTs7EqHnVSLm5.KYCZWgb5T2U LUaQAzg5kAugjNnkZHptmck.D5n8aQguBgQ78p1_ZWqwO9mKB_9TpYhB66CtY1OJqff2360fIzN8 GYpFdQ5U7PEwZQ_l_QcrYthw9GvZgPjpbiY_BNyqIwNB6cmOi3vp9aZUT_L2h01AJteqkcyP.SqO mZsfeYnJspkiagfCPm1z4pUB6ugj5ME8GSaeqVvvIt33ZkC2s9puEo9H.ylhJe56UXK7yc1sLJLl K11r6SRyVqRHIwOhb0h.LOW7uKqq36VnESpTOkWJOFeZb8a24uptmI0vIXuV_do73XNUK_1POuLH 3xw1gyeF3gH5t3eJDLRopZ8UYo64Au9t5H3h38DDSAeeqOzo74GNb2LjyD5detSQz7gJuA8fDkoC wiKw7VfxQOo_xc.7Ka9JU5mOi7O6mTsfU2OOzipXdY94UoUUz_Cf3tK3XdtbooGeiWHxEbTjaGAk aWTv_mqXvkjpHv.1rZw3qADxlPf7LxdV0aZIcDkbYPU8knDzmwWyx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cZnQ.JQefDw0i XbDM.GrWbPMVqqHrXCqH3co4lUcg50FjTyDnBkw0fiUVnp3by5qf6skkVWkJYR2logdwYJ5in3dI haueQLkNveAyFVMOJdWuieCmhUZ_naXUTHg5GSVrBgmctnC5y1rduBFG3Yj8bJUgOTAFhNVWLtX6 nh4AsPn1JILW2Jwkuxdm0t7dXv.QJ5xIJo7JAVqEkgGgN7Kmg8ReW06W4.w56eQll0M9_rVt_SJD FvV.92GfvyuzOu_1FjFrXDZPKtTpg2Y9OqLYlvGnyN3lg8XA014ER76csUCam16P3cocIoSMn0Qp nUlhcQl9MJxEG_4pRj71ejED2v2MXBCkXnpE6AzMZxi8PIvOPRy4jZyvxN7JP5Y1lukCYhjUzf.6 wc.ZUJXMhYLydZ0aYbAnmf2h86zgR31Atj_6fFd7QJLifz5VNFMKqiIQo2u9t.0B.aNDE_Bhemih 5qXfbVaJOBH_2bUkcXhfTa8W29t2XY_D26vfYYi8pi1udjfkNwFcMiAwd7XlaqyAq.IwRGyrRF7i gOdakQ7xLd3IMIjLmYbWVFRBHy.etXmshT0Z3DOjO8LOReHC5a2Zl7eJH73Vca4iDx36Kyn_Wue_ Q_0g4aNKXfU4F_h3enkPUG2RI7C3CD2bfzpV2Sq4trUTCIKCXm9n8jTkLLzn27KzeYtcOkOUXKAL IrxptyvHO.n_5JcaQATBC9rh_ysy_0h2dRQCqRYFliPoquGLCpI12Qx.A3aqZwegRRnlPu2AjEOC .nvhl3kAjsEAp4NtP7QF5hKYB5V2aID3WAe7yvixuGtFZR_RHbo8BNbkYmMvt2dDUX7afxwcYY0u 1DgSZnRUwDxrNedQ.w17TWeYKvrGl8eHLSLPafD5Adnw- Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Sat, 26 Dec 2020 20:18:24 +0000 Date: Sat, 26 Dec 2020 20:18:21 +0000 (UTC) From: Shantanu Shekhar To: Pgsql-general General Message-ID: <1135969024.2853124.1609013901725@mail.yahoo.com> Subject: Multi-column index vs index on individual columns MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2853123_869793075.1609013901723" References: <1135969024.2853124.1609013901725.ref@mail.yahoo.com> X-Mailer: WebService/1.1.17278 YMailNorrin Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Content-Length: 3091 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2853123_869793075.1609013901723 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I was going through Postgres documentation on multi-column indexes and came= across the recommendation at the bottom states: "Multicolumn indexes shoul= d be used sparingly. In most situations, an index on a single column is suf= ficient and saves space and time".=C2=A0 In my experience typical webapps the queries are known ahead of time and lo= t of the times the queries are restricted to a single table (no joins). Doe= s this recommendation that still apply in this use-case? I was under the im= pression that instead of scanning multiple indexes and then combining the r= esults, it may be more performant to simply use a single multi-index column= .=C2=A0 Thanks, Shantanu ------=_Part_2853123_869793075.1609013901723 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I was going through Po= stgres documentation on multi-column indexes and came across the recommenda= tion at the bottom states: "Multicolumn ind= exes should be used sparingly. In most situations, an index on a single col= umn is sufficient and saves space and time". 

In = my experience typical webapps the queries are known ahead of time and lot o= f the times the queries are restricted to a single table (no joins). Does t= his recommendation that still apply in this use-case? I was under the impre= ssion that instead of scanning multiple indexes and then combining the resu= lts, it may be more performant to simply use a single multi-index column.&n= bsp;

Thanks,

Shantanu
------=_Part_2853123_869793075.1609013901723--