Fastest way to delete data?

  Рет қаралды 3,937

SQL and Database explained!

SQL and Database explained!

Күн бұрын

Пікірлер: 20
@ecoworrier
@ecoworrier Жыл бұрын
Nice summary. Thanks Connor.
@sumitayadav6692
@sumitayadav6692 Жыл бұрын
Hi Connor... please make a detailed video on how to effectively read awr and addm reports.
@DatabaseDude
@DatabaseDude Жыл бұрын
its on the list
@steveandreassend8620
@steveandreassend8620 Жыл бұрын
Your last method at the end with MOVE ONLINE is elegant. If that's not possible, a fast solution for an in-place DELETE on large non-partitioned tables is to sort the rows for deletion by DB block ID by using the ROWID, may be using a temp table, and then batch deleting the rows. This reduces the db file sequential reads by clustering by physical location. Linux SD devices and often SAN devices will do a read ahead and pre-cache adjacent data blocks.
@DatabaseDude
@DatabaseDude Жыл бұрын
Indeed - an excellent option. I'd love to see the database do this natively
@Sagardua297
@Sagardua297 Жыл бұрын
Absolutely agree 💯
@rajaneeshrao4188
@rajaneeshrao4188 Жыл бұрын
Can we use multi threadding. I. e. dividing deleting rows with some logic and distributing to multiple session. Like dbms_parallel_execute where rows are distributed in chunks and each chunk is allocated to each session.
@DatabaseDude
@DatabaseDude Жыл бұрын
yes you can. dbms_parallel_execute is a common option here. That improves response time, but you'll be doing the same amount of work in total
@sagsag73
@sagsag73 Жыл бұрын
As always , there is tradeoff , in ordet o move the table and keep the needed rows (assuming we need to delete 20% of the table) we still need almost double the space. however, it is a great option !!!
@DatabaseDude
@DatabaseDude Жыл бұрын
Indeed. Although space is so cheap and plentiful nowadays (I know this is a generalisation :-))
@vikram4755
@vikram4755 Жыл бұрын
If we try this out on a 5 TB table and since its online, Database would need additional 5 TB to create a MV in background to support online?
@DatabaseDude
@DatabaseDude Жыл бұрын
Correct. A "move" always needs (temporarily) the old and new data.
@siddharthapenchala8146
@siddharthapenchala8146 Жыл бұрын
Sir, is it true ? 'Bulk collect' is the best approach to delete more a large number of rows efficiently from a table which contains huge amount of data?
@DatabaseDude
@DatabaseDude Жыл бұрын
bulk collect is definitely better than single row at a time, but native SQL (delete from ...) is implicitly the same or better than bulk collect
@rajaneeshrao4188
@rajaneeshrao4188 Жыл бұрын
But non- partitioned table to delete millions of rows bulk collect with some limit and commit is good right compared to simple delete?
@sumitayadav6692
@sumitayadav6692 Жыл бұрын
Hi..can you make a video on varchar 32k. I used in my table and found the row size got increased and the table is largest in db. Is v32k taking lots of space in asm .should i move to clob?
@DatabaseDude
@DatabaseDude Жыл бұрын
A varchar2(32k) is just a clob under the covers (once the data is larger than ~4k) so you incur all the same performance overheads
@eddiehapson1730
@eddiehapson1730 Жыл бұрын
Nice
@ryanwwest
@ryanwwest Жыл бұрын
Seems like a nuke would be faster.
@DatabaseDude
@DatabaseDude Жыл бұрын
"truncate" has always been very "thorough" :-)
DBSAT vs DataSafe. Which should I choose?
3:13
SQL and Database explained!
Рет қаралды 1,1 М.
Simple steps to Faster Database Code
15:46
SQL and Database explained!
Рет қаралды 2,2 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 22 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 138 МЛН
Patching and Upgrading in 90 seconds
2:20
SQL and Database explained!
Рет қаралды 362
Resolving ORA 12547 error
3:17
DBA Pro
Рет қаралды 4,8 М.
Performance boost for ALL_ARGUMENTS
5:20
SQL and Database explained!
Рет қаралды 217
Primary Key options for Partitioned Tables
16:40
SQL and Database explained!
Рет қаралды 1,3 М.
Which rows are locked in my database?
7:15
SQL and Database explained!
Рет қаралды 1,3 М.
The BEST way to FETCH from the database
11:58
SQL and Database explained!
Рет қаралды 1,9 М.
The mysterious KEEP clause in SQL
4:05
SQL and Database explained!
Рет қаралды 2,4 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН