Thread: Using Indices
Hi, when I use phpPgAdmin to create DBs, my Indices are getting automatic names like : pers_UID_key I am getting confused about the name! Does that mean a need to do call this in a select query? "select * from pers where pers_UID_key = '...'" or do i call the original field? "select * from pers where UID= '...'" Thanx, Alex -- ___________________________ Alexander Lohse Human Touch Medienproduktion GmbH Am See 1 17440 Klein Jasedow Tel: (038374) 75211 Fax: (038374) 75223 eMail: al@humantouch.de http://www.humantouch.de
Hi You should use the original field name. You don't have to worry about the indicies after they're created. Postgres uses them automagicaly whenever she think they'll speed up your queries. The name of the index is choosen to make it easy to understand what it's indexing (pers table, uid key in your case) Hope it helps. Regards, Patrik Kudo ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på! On Sun, 1 Apr 2001, Alexander Lohse wrote: > Hi, > > when I use phpPgAdmin to create DBs, my Indices are getting automatic > names like : pers_UID_key > > I am getting confused about the name! > > Does that mean a need to do call this in a select query? > > "select * from pers where pers_UID_key = '...'" > > or do i call the original field? > > "select * from pers where UID= '...'" > > Thanx, > > Alex > -- > ___________________________ > Alexander Lohse > Human Touch Medienproduktion GmbH > Am See 1 > 17440 Klein Jasedow > > Tel: (038374) 75211 > Fax: (038374) 75223 > eMail: al@humantouch.de > http://www.humantouch.de > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
Alexander Lohse wrote: > > when I use phpPgAdmin to create DBs, my Indices are getting automatic > names like : pers_UID_key > > I am getting confused about the name! > > Does that mean a need to do call this in a select query? > > "select * from pers where pers_UID_key = '...'" > > or do i call the original field? > > "select * from pers where UID= '...'" In relational databases you should not care much about indices when writing simple queries. They are used automagically by the query planner according to need. Many times the planner will do a better job of improving performance than a common programmer. And if you decide to change your indices, there's no need to rewrite your programs and queries. I would recommend that anyone coming to relational databases read "An Introduction to Database Systems", 7th Ed, by Chris J Date - Addison-Wesley, October 1.999, ISBN 0201385902; around US$ 58 used, US$ 72 new. The relational world is very, very different from "navigational databases", and even if it is far simpler for the user it takes some getting used to by programmers. -- _ / \ Leandro Guimarães Faria Corsetti Dutra +55 (11) 3040 8913 \ / Amdocs at Bell Canada +1 (514) 786 87 47 X Support Center, São Paulo, Brazil mailto:adbaamd@bell.ca / \ http://terravista.pt./Enseada/1989/ mailto:leandrod@amdocs.com
>Hi > >You should use the original field name. You don't have to worry about the >indicies after they're created. Postgres uses them automagicaly whenever >she think they'll speed up your queries. The name of the index is choosen >to make it easy to understand what it's indexing (pers table, uid key in >your case) > >Hope it helps. Yeap, that was what I needed. Thanx. Alex -- ___________________________ Alexander Lohse Human Touch Medienproduktion GmbH Am See 1 17440 Klein Jasedow Tel: (038374) 75211 Fax: (038374) 75223 eMail: al@humantouch.de http://www.humantouch.de