What you said Insert script it will not work all wrong
@kebincui15 күн бұрын
The most vivid explatnion about joins., easy to understand👍👍 thanks
@graht115 күн бұрын
The right side of the tree was just bugging me :) It can be fixed with REVERSE. WITH tree ( lvl, fill ) AS ( SELECT 1 lvl, LPAD('*', 11, ' ') fill FROM dual UNION ALL SELECT lvl + 1 lvl, LPAD( LPAD( RPAD( '|', lvl + 1, '\' ), ((lvl + 1) * 2) - 1, '/' ), 12 + lvl - 1, ' ' ) fill FROM tree WHERE 1=1 AND lvl < 8 ) SELECT '''' || RPAD( REVERSE( REPLACE( REVERSE( REPLACE( fill, '//', '/*' ) ), '\\', '\*' ) ), 21, ' ' ) || '''' xmastree FROM tree UNION ALL SELECT '''' || rpad( LPAD('|||', 12, ' '), 21, ' ' ) || '''' from dual
@Артем-х7п6сАй бұрын
8:15 I don't understand this case. If we need to join only five cards to other deck then why hash join have got to go through every single card in first deck?? Is it not equivalent to "first table(5 cards except first deck) join second table (second deck)"? Then we just need to make hash table with 5 hashes
@Артем-х7п6сАй бұрын
Oh, I found the answer below
@brucewetzelАй бұрын
Love these quick, yet so informative videos. Please keep them coming. Thank you!
@TheMagicofSQLАй бұрын
You're welcome; glad you appreciate these. I certainly plan to keep publishing these :)
@ilpaolotopleggend6663Ай бұрын
Thanks
@francodominguez304Ай бұрын
Bro, thank you very much for all the knowledge you transmit. Out of curiosity, what is the IDE you use in your videos? Are you using any VSCode extension? Greetings from Argentina!
@TheMagicofSQLАй бұрын
Thanks - you're welcome. I create these using an internal tool here at Oracle
@onehmong9368Ай бұрын
Always nice
@onehmong9368Ай бұрын
Nice
@onehmong9368Ай бұрын
Huh
@mprokop6Ай бұрын
no audio?
@TheMagicofSQLАй бұрын
No - is it necessary?
@mprokop6Ай бұрын
@@TheMagicofSQL If this was intentional, then nvm
@mprokop6Ай бұрын
It's just quite common for videos to have some kind of voiceover
@TheMagicofSQLАй бұрын
Yeah - I'm experimenting to see how this works. I can try talking over these if you're keen to hear my voice ;)
@chungusmcjaxx57992 ай бұрын
Thanks. Explained visually nested loops in 90 seconds. Appreciate your method with cards. Thank you.
@TheMagicofSQLАй бұрын
You're welcome; glad you appreciate it!
@avimcrypto2 ай бұрын
Can i change the query snap UI... Different to see and to understand... Can u make some changes in video... And make graphic easier
@TheMagicofSQL2 ай бұрын
What changes do you want to see? What would make graphic easier?
@onehmong93682 ай бұрын
So serious man. I swear they would crucify me if I write sql in lower cases. Thanks
@TheMagicofSQL2 ай бұрын
If you're using a standard formatter for SQL, it makes sense to use the same case for all statements. If not, there's much more important things to get worked up about!
@onehmong93682 ай бұрын
@TheMagicofSQL nice
@onehmong93682 ай бұрын
Aaah I don't feel too bad writing sql in lower case like in c and c++
@TheMagicofSQL2 ай бұрын
Lowercase is the way!
@nguyennguyenkhoi71112 ай бұрын
Thanks bro, It's really nice and clear explaination. However, I still have 1 question. Why do we need to run "Hash Function" in the whole table? Why don't we hash 5 cards and do the JOIN?
@TheMagicofSQL2 ай бұрын
See my response to ArthurMontgomery-d2p - how do you know which 5 rows to pick from the first table?
@pablolocles93822 ай бұрын
But doing that you won't achieve the best performance using indexes and keys. Join handles it much better, even if you don't use the other table outputs.
@TheMagicofSQL2 ай бұрын
Can you demonstrate a case where that happens? Oracle Database transforms IN/EXISTS into joins under the covers, so the performance of these three should be identical
@FiruzzZ-7772 ай бұрын
flawless explanations!, you deserve your hair back
@TheMagicofSQL2 ай бұрын
😂 thanks!
@staykings69432 ай бұрын
Thanks for this 💱
@IncredibleAdventure12 ай бұрын
Hello Chris, I have one question regarding order by. Does Oracle Database sort results in ascending order based on the first column of the first query when using set operator Union implicitly(by default)?
@TheMagicofSQL2 ай бұрын
No. If you use UNION ALL the database just combines the data sets. If you use UNION it'll add a deduplication step. This *might* be implemented using a sort. A hash is more likely though.
@francisantony123 ай бұрын
This helped me a lot. Thank you for this video
@TheMagicofSQL2 ай бұрын
You're welcome! Glad this is useful
@ArthurMontgomery-d2p3 ай бұрын
Great video. Thanks. But I didn't understand the reason why the example of joining only five cards in the outer deck shows the disadvantage of hash join (from 8:17 to 8:25). I mean, why can't we simply apply the hash function to those five values? That only costs five operations to construct the hash memory structure?
@TheMagicofSQL3 ай бұрын
How do you know what the top five values are before doing the join? If you want to (inner) join t1 to t2 and get the first five joined rows there's no general way to pick five from t1 that will join to t2. The values you pick from t1 may have no match in t2. Using a hash, you have to read all the rows from t1. Then join to t2, stopping as soon as you have five rows in the results.
@ArthurMontgomery-d2p3 ай бұрын
@@TheMagicofSQL Thanks for the clarification! I took the five cards as already known.😅
@nishanksoni71203 ай бұрын
1.Nested Join - nested for loop - O(N * N) - easiest to implement - time consuming for large dataset - better with either small datasets or index on join attributes 2.Merge Join - sort them first and compare - O(NlogN) + O(NlogN) - Efficient for large datasets - pre-join preparation required (sorting) - scanning of relation happens once while joining - can leverage indexes if available to make it faster 3.Hash Join - using hashing - not good for range queries - creating a hashtable for the query you are searching ( user_id is the key) - used for equi joins - efficient for large datasets - requires additional memory - pre join preparation required -> hash table construction - Hash function should distribute data evenly SQL Engine : Take a look at data , look statistics across all table using cardinality
@TheMagicofSQL3 ай бұрын
Nice summary. Though - at least in Oracle Database - hash join is worse than "not good" for range queries. The optimizer won't use it at all!
@sandhu013 ай бұрын
Very well put 👏 @6:20 - 52*log52 equals 296.4 because the base is 2 not 10.
@TheMagicofSQL3 ай бұрын
52 * ln 52 ~ 205 isn't it? :) In any case, the exact numbers don't matter too much here - they will vary depending on the algorithm used. It's more the relative size of operations needed for each join type.
@sandhu013 ай бұрын
@@TheMagicofSQL thanks for the reply! Understood! That's why appreciation was in first place :)
@PradeepKanaparthy4 ай бұрын
HI please one more favour. need post on tuning complex query having multiple joins with example to see changes before tuning and after tuning. some of the tuning changes or tips and how they affect the query and make quick access or give response
@TheMagicofSQL4 ай бұрын
I recently ran an Ask TOM Office Hours session going through some real world tuning examples - see the recording at kzbin.info/www/bejne/m6itkqCEipt8j5I
@PradeepKanaparthy4 ай бұрын
@@TheMagicofSQL Thank you 😊
@surajkumarsingh48574 ай бұрын
Wow What an Explanation : )
@TheMagicofSQL4 ай бұрын
Thanks :)
@danpd12384 ай бұрын
nice video!
@user-qb7cc3cw7l4 ай бұрын
Please go little so your accent not comfortable for asians😢😢
@andrevinicius1375 ай бұрын
Pure Gold!
@NuProg6 ай бұрын
I have to create index for a huge table (In Gigabytes) for a new column. But when we tried this, it is bringing down the system completely so we had to drop that. Is there any way we can create this index without downtime.
@TheMagicofSQL6 ай бұрын
I'm unsure what "bringing down the system completely" means exactly. In Oracle Database you can CREATE INDEX ... ONLINE which allows the database to write to the table while creating the index which may help here.
@NuProg6 ай бұрын
@@TheMagicofSQL Thank you for the quick reply. 'Bringing down' - I was meaning that the CPU and memory were full due to the size of the table and was taking hours to complete. So is there a way to create index in a performant way on this table?
@TheMagicofSQL6 ай бұрын
While a table in the gigabytes is big, it still shouldn't take hours to create an index on it. Creating an index will only use 1 cpu by default. So either the system only has a couple of cpus (in which case you should look at getting more) or it's running in parallel - reducing the parallelism will help. I would still start by using the ONLINE keyword when creating the index before trying anything else though. It might take a long time, but other operations should continue normally (unless your system does have to few CPUs for the workload)
@NuProg6 ай бұрын
@@TheMagicofSQL Thanks again. I shall try this and will update here on how it goes.
@emilemary6 ай бұрын
Excellent presentation, the best SQL course!! I love the creativity in your videos. Thank you so much!!
@TheMagicofSQL6 ай бұрын
You're welcome, glad you appreciate these!
@HarrietOmboga6 ай бұрын
I like how its explained though I dont get most of it
@TheMagicofSQL6 ай бұрын
What is it you're struggling to understand?
@SinskariBoi3366three6 ай бұрын
Refreshing
@hindimotivation52317 ай бұрын
I am not able to understand the autotrace part where view part individual elapsed time is 728 micro seconds. How this was calculated , Please elaborate. Thankyou.
@hindimotivation52316 ай бұрын
One more doubt , in 3rd sort operation why it dont have any elpsed time as you said in video.
@TheMagicofSQL6 ай бұрын
I'm not sure exactly what you're referring to - please clarify. In any case, this value comes from the database measuring how long the operation took.
@TheMagicofSQL6 ай бұрын
Again, I'm not sure exactly what you're referring to.
@IgorSadovskii7 ай бұрын
usefull explanation ! thanks a lot!
@robertczaja1767 ай бұрын
Well explained!
@robertczaja1767 ай бұрын
Perfect video! You can explain things that everyone can understand it!
@dothanhlong18477 ай бұрын
.
@AndrewCoffman-jq9ld7 ай бұрын
Been doing MSSQL for 20 years and this was by far the best explanation of these joins. Thanks!