Re: Query planning around one key of a multi-column index
Wells Oliver <[email protected]> Wed, 18 Dec 2019 20:18:46 -0800
| Newsgroups | gmane.comp.db.postgresql.admin |
|---|---|
| Message-ID | <CAOC+FBWzn-TK99tZNP4s=HkFk1qWr6QXGnqDarLCKrBK5g_tXA@mail.gmail.com> |
--000000000000aa090f059a06dda4 Content-Type: text/plain; charset="UTF-8" But so are you guys! Thanks, this is helpful. Is it really always true that querying off any column that's not the first column of a multi-column index will NOT use that index? On Wed, Dec 18, 2019 at 7:02 PM Craig James <[email protected]> wrote: > Google is your friend: > > http://www.postgresqltutorial.com/postgresql-indexes/postgresql-multicolumn-indexes/ > > On Wed, Dec 18, 2019 at 4:43 PM Wells Oliver <[email protected]> > wrote: > >> I've been using PG now for so many years and I don't have a solid >> concrete answer on this in my head, and I feel like I should: if I have a >> table with a multi-column index and I query on one of those columns (or >> some subset of those columns), will it use that index? >> >> Is there more reading on this topic? I've always felt it's a little more >> complicated but I'm not quite sure. >> >> -- >> Wells Oliver >> [email protected] <[email protected]> >> > > > -- > --------------------------------- > Craig A. James > Chief Technology Officer > eMolecules, Inc. > 3430 Carmel Mountain Road, Suite 250 > San Diego, CA 92121 > --------------------------------- > -- Wells Oliver [email protected] <[email protected]> --000000000000aa090f059a06dda4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>But so are you guys!</div><div><br></div><div>Thanks,= this is helpful.</div><div><br></div><div>Is it really always true that qu= erying off any column that's not the first column of a multi-column ind= ex will NOT use that index?</div><div><br></div></div><br><div class=3D"gma= il_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 18, 2019 at 7:0= 2 PM Craig James <<a href=3D"mailto:[email protected]">cjames@emolec= ules.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D= "margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le= ft:1ex"><div dir=3D"ltr">Google is your friend:<div><a href=3D"http://www.p= ostgresqltutorial.com/postgresql-indexes/postgresql-multicolumn-indexes/" t= arget=3D"_blank">http://www.postgresqltutorial.com/postgresql-indexes/postg= resql-multicolumn-indexes/</a><br></div></div><br><div class=3D"gmail_quote= "><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 18, 2019 at 4:43 PM Wel= ls Oliver <<a href=3D"mailto:[email protected]" target=3D"_blank">w= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_qu= ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20= 4);padding-left:1ex"><div dir=3D"ltr"><div>I've been using PG now for s= o many years and I don't have a solid concrete answer on this in my hea= d, and I feel like I should: if I have a table with a multi-column index an= d I query on one of those columns (or some subset of those columns), will i= t use that index?</div><div><br></div><div>Is there more reading on this to= pic? I've always felt it's a little more complicated but I'm no= t quite sure.<br></div><div><br>-- <br><div dir=3D"ltr"><div dir=3D"ltr"><d= iv>Wells Oliver<br><a href=3D"mailto:[email protected]" target=3D"_blan= k">[email protected]</a></div></div></div></div></div> </blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"= ><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div><div>--------------------= -------------<br>Craig A. James<br></div>Chief Technology Officer<br></div>= eMolecules, Inc.<br></div><div>3430 Carmel Mountain Road, Suite 250</div><d= iv>San Diego, CA 92121<br></div>---------------------------------<br></div>= </div></div></div> </blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g= mail_signature"><div dir=3D"ltr"><div>Wells Oliver<br><a href=3D"mailto:wel= [email protected]" target=3D"_blank">[email protected]</a></div></div= ></div> --000000000000aa090f059a06dda4--