Reply to Re: Insert duplicate row practice

Your name:

Reply:


Posted by Stefan Rybacki on 10/06/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 =----

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация