karto
karto

Reputation: 3668

php/mysql better option in updating very huge tables

I have two huge tables. I want to update all fields in the second table with the first if productid and userid matches or insert new if not exist. Will a JOIN be better than a simple UPDATE? What about REPLACE INTO? Can someone help me with the best optimal decision? because the tables are huge.

Thanks.

Upvotes: 4

Views: 332

Answers (1)

user103307
user103307

Reputation: 29

100 billion is pretty rare so I assume you won't find a reliable answer on stackoverflow.

You should do your own benchmarks, look at the EXPLAIN keyword on mysql.com and write a short script (php one here) to analyze the time spent.

On a parallel note, I'm not sure whether MySQL is the best choice for a 100 billion database.

Upvotes: 1

Related Questions