php-db | 2001062
Date: 06/23/01
- Next message: Al Savage: "[PHP-DB] Re: Extracting enum/set values from database"
- Previous message: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- In reply to: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Next in thread: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Reply: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Reply: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
Thanks!
- Noah
""Manuel Lemos"" <mlemos <email protected>> wrote in message
news:785.574T2670T8255351mlemos <email protected>
> Hello Noah,
>
> On 23-Jun-01 12:10:20, you wrote:
>
> >I see,
>
> >What about if you had 3 or 4 columns that would always be unique, is
there
> >an advantage to naming them as primary keys? does this slow inserts
because
> >it has to check if theres a duplicate entry?
>
> What really slows down is updating the index with the new entry value.
>
> Anyway, some times it may pay to slow down inserts and updates for very
> large tables. You have to check if the indexes/primary keys that you are
> adding are used as the first condition of the WHERE clause.
>
>
>
> Regards,
> Manuel Lemos
>
> Web Programming Components using PHP Classes.
> Look at: email protected>?subject=Re:%20[PHP-DB]%20advantages/disads%20of%20primary%20keys%20and%20indices?&replyto=9h2jmm$ej3$1 <email protected>">mlemos <email protected>">http://phpclasses.UpperDesign.com/?user=mlemos <email protected>
> --
> E-mail: mlemos <email protected>
> URL: http://www.mlemos.e-na.net/
> PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
> --
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Al Savage: "[PHP-DB] Re: Extracting enum/set values from database"
- Previous message: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- In reply to: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Next in thread: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Reply: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Reply: Manuel Lemos: "Re: [PHP-DB] advantages/disads of primary keys and indices?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

