http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
On Mon, Apr 20, 2009 at 19:59, Joseph <[email protected]> wrote: > > This may not be the best thing to do in the case of statuses. > Optimization implies that you have two tables (minimum), one for the > user info, and one for the tweets. Doing a batch update, means that > you're skipping the step of checking to see if the user is already in > the database, so for every tweet, you will add the same user again. > That will you will slow you down much more than the batch advantage, > and will create confusion (unless you store all in one table, and > that's even more burdensome). > > Now, does anyone know if there's some obscure version of UPDATE that > takes parameters to allow me to use UPDATE instead of INSERT (saving > me from the extra step of checking of the person is already in my > database). I'm fairly new to MySQL. > > On Apr 20, 4:14 pm, Nick Arnett <[email protected]> wrote: > > On Mon, Apr 20, 2009 at 3:16 PM, Doug Williams <[email protected]> wrote: > > > > 3. For each status in the set, perform an SQL insert to save the status. > > > > Or, I would hope, create an array of inserts and do a multi-insert, which > > will be far faster than iterating through a list. > > > > http://www.desilva.biz/mysql/insert.html > > > > I'll bet you knew that, but I just had to note it because the performance > > difference is enormous. > > > > Nick > > (not really a PHP guy, but years of (often painfully gained) MySQL > > performance knowledge) > -- Abraham Williams | http://the.hackerconundrum.com Hacker | http://abrah.am | http://twitter.com/abraham Web608 | Community Evangelist | http://web608.org This email is: [ ] blogable [x] ask first [ ] private. Sent from Madison, Wisconsin, United States
