*light goes on* You know, I think I've been confused about that. Thanks for clearing things up. I for some reason didn't make the connection (no pun intended) that each page would be getting it's own connection to the DB, and so couldn't interfere with the last_insert_ID queries.
Matthew Walker Senior Software Engineer ePliant Marketing -----Original Message----- From: Benjamin Pflugmann [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 8:39 AM To: Matthew Walker Cc: Craig Westerman; MySQL List Subject: Re: MySQL counter for HIGH traffic site Hello. First let me say, that I was talking about the MySQL side of things. If pconnect was broken in this regard - and I would call the behaviour you described as broken - just don't use it. On Mon, Apr 15, 2002 at 12:14:07AM -0600, [EMAIL PROTECTED] wrote: > Actually, with a pconnect, there would be a trade off. > Since it uses a shared connection, the last insert ID could change > between the update and calling the api function. That said, where did you get this from? As I read it, mysql_pconnect() reuses a connection _only_, if it remained open from an ealier - not if it is still in use. Else a lot of things would not work (e.g. using locks at all). This is taken from http://www.php.net/manual/en/function.mysql-pconnect.php and http://www.php.net/manual/en/features.persistent-connections.php There are some caveats, but only with side-effects of the fact that the connection will not be closed. I.e. regarding mysql_pconnect(), calling mysql_insert_id() from the PHP API should be safe as long as you did not call mysql_close(). Bye, Benjamin. > But as I said, it doesn't matter for the counter. > > Matthew Walker > Senior Software Engineer > ePliant Marketing > > > -----Original Message----- > From: Benjamin Pflugmann [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 14, 2002 9:47 PM > To: Matthew Walker > Cc: Craig Westerman; MySQL List > Subject: Re: MySQL counter for HIGH traffic site > > Hi. > > There is a one-query method to do that and it is even explicitly > documented: http://www.mysql.com/doc/M/i/Miscellaneous_functions.html > (under LAST_INSERT_ID([expr])). This requires an UPDATE and using a > client API function like mysql_insert_id(). No locks needed and the > operation is atomic (i.e. no 'precision' trade-off). [...] -- [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.345 / Virus Database: 193 - Release Date: 4/9/2002 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php