Re: advantages/disads of primary keys and indices?

From: Date: Sat, 23 Jun 2001 18:08:21 +0000
Subject: Re: advantages/disads of primary keys and indices?
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-9775@lists.php.net to get a copy of this message
Hello, > Thank you! this wont slow updates or inserts? Not the updates. The update query will use the index to lookup find the table line that it will update. Then, since you will not change any of the indexed columns the index does not need to be updated too. Manuel Lemos > > ----- Original Message ----- > From: "Manuel Lemos" <mlemos@acm.org> > To: "Noah Spitzer-Williams" <noahsw@cyberdude.com> > Sent: Saturday, June 23, 2001 1:54 PM > Subject: Re: [PHP-DB] advantages/disads of primary keys and indices? > > > > Hello Noah, > > > > On 23-Jun-01 14:29:58, you wrote: > > > > >Yeah the keys would be part of the first condition of the where clause... > > > > >this table is like this: > > >username | siteid | bannerid | clicks | someotherstat > > > > > > >an update would be like: update tbl set clicks=clicks+1 where > > >username='something' and siteid='something' and > > >bannerid='something' > > > > >a select would be: select clicks from tbl where username='something' and > > >siteid='something' and bannerid='something' > > > > > > >so knowing this, does it make sense to make primary keys out of > > >username,siteid,bannerid? > > > > Yes, you should make a single primary key with all the three fields: > > username, siteid and bannerid. > > > > > > Regards, > > Manuel Lemos > > > > Web Programming Components using PHP Classes. > > Look at: > > http://phpclasses.UpperDesign.com/?user=mlemos@acm.org > > -- > > E-mail: mlemos@acm.org > > URL: http://www.mlemos.e-na.net/ > > PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp > > -- > > > >

« previous php.db (#9775) next »