|
Posted by Stefan Rybacki on 10/14/48 11:28
Du wrote:
> I use mysql to monitor the download traffic from my website. I defined
> user_id and the file name as the primary key.
>
Do you mean you have a combined primary key (user_id, filename)?
> My question is, shoud I check if the item already existed in the database
> before add or should I leave mysql handle duplicate primary key checking ?
>
> Can you tell which method is more efficient?
It depends. The result is the same, in case one you get the already existing entry in case
two you get an error. I guess the first case is the better one, since you get the already
existing entry and are able to use this for further processing instead.
Regards
Stefan
>
> Thanks
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Navigation:
[Reply to this message]
|