No video

Update a Table with Millions of Rows in SQL (Fast)

  Рет қаралды 8,979

Database Star

Database Star

Күн бұрын

Пікірлер: 16
@prashlovessamosa
@prashlovessamosa Жыл бұрын
Your channel is very helpful sir thank you providing knowledge for free.
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks! I’m glad you like it.
@RAMII19780529
@RAMII19780529 Жыл бұрын
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.
@Firecul
@Firecul Жыл бұрын
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.
@DatabaseStar
@DatabaseStar Жыл бұрын
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.
@DatabaseStar
@DatabaseStar Жыл бұрын
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!
@slaybryn5504
@slaybryn5504 5 ай бұрын
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.
@DatabaseStar
@DatabaseStar 5 ай бұрын
I think you can use a function that replaces string characters with others. In MySQL it’s called REPLACE.
@coolcha
@coolcha Жыл бұрын
Would update in batches be beneficial for a live app, thereby making the app available for use in between the batches?
@DatabaseStar
@DatabaseStar Жыл бұрын
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,
@coolcha
@coolcha Жыл бұрын
@@DatabaseStar I see. Thanks.
@kane_lives
@kane_lives 11 ай бұрын
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.
@DatabaseStar
@DatabaseStar 11 ай бұрын
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.
@slaybryn5504
@slaybryn5504 5 ай бұрын
@@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?
@karthiks4347
@karthiks4347 Ай бұрын
👏👏👍
@DatabaseStar
@DatabaseStar Ай бұрын
Thanks!
99% Cost Improvement in This SQL - See How It’s Done
19:12
Database Star
Рет қаралды 4,1 М.
Querying 100 Billion Rows using SQL, 7 TB in a single table
9:07
Arpit Agrawal (Elastiq.AI)
Рет қаралды 50 М.
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 18 МЛН
Adding Columns With Data SQL
9:37
Dimitri Patarroyo
Рет қаралды 32 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 72 М.
Monitor long running sessions in oracle
7:01
DeltaDBA
Рет қаралды 3,6 М.
When to Use a Subquery in SQL
8:50
Database Star
Рет қаралды 32 М.
SQL indexing best practices | How to make your database FASTER!
4:08
33 How to update a large sql table in chunks
8:22
Learn SSIS
Рет қаралды 3,6 М.
I loaded 100,000,000 rows into MySQL (fast)
18:27
PlanetScale
Рет қаралды 177 М.
Inserting 10 Million Records in SQL Server with C# and ADO.NET (Efficient way)
6:45
Programming with Felipe Gavilan
Рет қаралды 19 М.
Faster Inserts!
5:06
SQL and Database explained!
Рет қаралды 6 М.