List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:May 31 2004 8:14pm
Subject:Re: Feature Request: UPDATE 'error codes' or mysql_affected_rows()
to be more "accurate"
View as plain text  
Daevid Vincent wrote:
> Well, my "hack" (which is sort of like what you suggest) is to change my
> primary key from just an auto_increment 'id' field to a combination of two
> other fields (mac/scanner_id) that I know must be unique. Then I rely upon
> the fact that mySQL will not allow a duplicate PK. (I did say it was a
> hack). A co-worker assures me that a SELECT is cheap, however a version I
> tried (without my hack) still allowed duplicates to slip through because I
> wasn't locking the tables. I have multiple scanners hitting the same table
> and locking seems to me a bad idea.
> 
> Also, I guess my TIMESTAMP brainstorm won't work b/c the resolution of that
> field is 1 second and these queries happen faster than that. *Neuman!*  :-/
> 
> REPLACE INTO won't work, as I need the previous record (hence the update). I
> store the first and last time I saw a node, amongst other info. REPLACE
> would delete that data.
> 
> http://daevid.com

Daevid:

I believe what Steve suggests is the cleanest solution under the assumption you 
are willing to move to 4.1. If not, your college has a very good point - any 
one-row operation on MySQL is very fast - on modern hardware (AMD XP 2200+ or 
faster) you are looking at the order of magnitude of 10,000 per seconds.


-- 
Sasha Pachev
Create online surveys at http://www.surveyz.com/
Thread
Feature Request: UPDATE 'error codes' or mysql_affected_rows() to be more "accurate"Daevid Vincent27 May
  • Re: Feature Request: UPDATE 'error codes' or mysql_affected_rows()to be more "accurate"Robert J Taylor27 May
  • Re: Feature Request: UPDATE 'error codes' or mysql_affected_rows()to be more "accurate"Steve Meyers27 May
    • RE: Feature Request: UPDATE 'error codes' or mysql_affected_rows() to be more "accurate"Daevid Vincent27 May
      • Re: Feature Request: UPDATE 'error codes' or mysql_affected_rows()to be more "accurate"Sasha Pachev31 May
      • RE: Feature Request: UPDATE 'error codes' ormysql_affected_rows() to be more "accurate"Robert A. Rosenberg1 Jun