It would seem that the first method would always be the fastest. The REPLACE function basically runs an INSTR on every row, changing the data when it finds a match. Every other example will do more work. For example, in Method 2, the INSTR runs on every row, then REPLACE has to search the subset of rows again to locate the text and replace it. The other methods all add additional overhead while still searching some fields twice. The fastest way would be to run it in parallel if your DB supports it.
I'm a relative noobie with dbs but I'd have to agree with you here. I'm not sure how it could get faster than only checking everything once and updating as needed. Perhaps this might not have been the best example to get across what he meant.
Yeah that's true, that explains why the first method is fastest. And the database is pretty good at determining how to run the update statement efficiently.
That's a good point! Yes I think the example in this video showed that the simplest method was the fastest. If a different type of update was done, then perhaps it would be slower. So it probably wasn't the best example!
Yeah it might be good in that situation. It could be good if you have a scheduled maintenance period, and run updates during this period (for example, 1 hour each night), and then run more updates the next day,
Can you show me that I want to update mysql database on Column Address to be masking with custom way like replacing * and & sign round. eg. 'address' to '*d&ras&' to all 30million rows. How to solve plz help me.
What is the point of this video? The most obvious and naive method is the fastest, while the rest are convoluted and do extra work for no good reason. 99% of the videos on this channel are good to great, but I would just delete this one if I were in your shoes.
Thanks for the feedback! I guess the point of the video is that yes, the simplest method is the fastest. There are many other ways that it could be done and that may seem faster, but are actually slower in this example.
@@DatabaseStar I thought that method 3 batching is fastest for larger 100million rows records. Because the fastest naive method 1 can't run for larger rows. It will stop, is it right?
It would seem that the first method would always be the fastest. The REPLACE function basically runs an INSTR on every row, changing the data when it finds a match. Every other example will do more work. For example, in Method 2, the INSTR runs on every row, then REPLACE has to search the subset of rows again to locate the text and replace it. The other methods all add additional overhead while still searching some fields twice. The fastest way would be to run it in parallel if your DB supports it.
I'm a relative noobie with dbs but I'd have to agree with you here. I'm not sure how it could get faster than only checking everything once and updating as needed.
Perhaps this might not have been the best example to get across what he meant.
Yeah that's true, that explains why the first method is fastest. And the database is pretty good at determining how to run the update statement efficiently.
That's a good point! Yes I think the example in this video showed that the simplest method was the fastest. If a different type of update was done, then perhaps it would be slower. So it probably wasn't the best example!
Your channel is very helpful sir thank you providing knowledge for free.
Thanks! I’m glad you like it.
Would update in batches be beneficial for a live app, thereby making the app available for use in between the batches?
Yeah it might be good in that situation. It could be good if you have a scheduled maintenance period, and run updates during this period (for example, 1 hour each night), and then run more updates the next day,
@@DatabaseStar I see. Thanks.
Can you show me that I want to update mysql database on Column Address to be masking with custom way like replacing * and & sign round. eg. 'address' to '*d&ras&' to all 30million rows. How to solve plz help me.
I think you can use a function that replaces string characters with others. In MySQL it’s called REPLACE.
What is the point of this video?
The most obvious and naive method is the fastest, while the rest are convoluted and do extra work for no good reason.
99% of the videos on this channel are good to great, but I would just delete this one if I were in your shoes.
Thanks for the feedback! I guess the point of the video is that yes, the simplest method is the fastest. There are many other ways that it could be done and that may seem faster, but are actually slower in this example.
@@DatabaseStar I thought that method 3 batching is fastest for larger 100million rows records. Because the fastest naive method 1 can't run for larger rows. It will stop, is it right?
👏👏👍
Thanks!