How to Create Database Indexes: Databases for Developers: Performance #4

  Рет қаралды 26,413

The Magic of SQL

The Magic of SQL

Күн бұрын

Пікірлер: 41
@sebon11
@sebon11 4 жыл бұрын
Woooooow, man! This was SO CLEAR explanation, nice! I'm impressed with the quality of the vid with everything - sound hq, switching between bricks, code and drawings where needed, highlighting the stuff and everything. Very good video!
@TheMagicofSQL
@TheMagicofSQL 4 жыл бұрын
Thanks, glad you found this useful :)
@SubhashPophale
@SubhashPophale 3 жыл бұрын
This won't be exaggeration if I say you read a whole lot pages and watch the this 13 min video. Excellent and lucid explaination of Indexes in oracle database.
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
Thanks, glad you found this useful!
@Sam-Land
@Sam-Land 4 жыл бұрын
I wish I had watched this years ago to explain the ordering. I'm going to be breaching this video
@eduardodelcorrallira529
@eduardodelcorrallira529 4 жыл бұрын
I was about to thumb it up and realized it already was. Plenty of Aha! Moments Very clear, and fun too :)
@TheMagicofSQL
@TheMagicofSQL 4 жыл бұрын
Great to hear :)
@amirthalakshmi7348
@amirthalakshmi7348 3 жыл бұрын
Thank you very much... It's really really very very useful.,.. This series deserves more views..
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
You're welcome, please share these with anyone you think they can help :)
@hectorcortes92
@hectorcortes92 4 жыл бұрын
Amazing!! Thanks!
@jayhaygh
@jayhaygh 3 жыл бұрын
Brilliant! This deserves more views
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
Thanks, glad you enjoyed this!
@Nick71NA
@Nick71NA 3 жыл бұрын
Wonderful explanation. Only a observation, complexity for the use of index in B-tree is O(log(N)) where the logarithm base is b.
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
Thanks. Is your observation related something specific in the video?
@Nick71NA
@Nick71NA 3 жыл бұрын
@@TheMagicofSQL Only a clarification, in the video you explain the complexity for the access at B-Tree. Thanks a lot for your teachments
@PramodPattar-gl4df
@PramodPattar-gl4df Жыл бұрын
Hi Chris, Amazing videos with simple and clear way of explanation.👍 I Do have a doubt, if we have a table where 90-95% of a column data values are unique. can we still create a primary key or unique index on that column. how can we use that column values efficiently for data access?
@TheMagicofSQL
@TheMagicofSQL Жыл бұрын
The values in a PK/Unique index must be unique. If there are any duplicates you can't create a validated constraint. As long as your queries get "few" rows from the table a regular (non-unique) index works fine
@PramodPattar-gl4df
@PramodPattar-gl4df Жыл бұрын
@@TheMagicofSQL Thank you Chris for quick reply. 🙂 How can I get in touch with you further. I have some queries using views which turns out to be a nightmare seeing their execution plans and performance is bad. Need your expertise guidance a bit.
@TheMagicofSQL
@TheMagicofSQL Жыл бұрын
@@PramodPattar-gl4df You can submit questions at asktom.oracle.com; please ensure you include the execution plans & details of what you've tried
@NuProg
@NuProg 5 ай бұрын
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.
@TheMagicofSQL
@TheMagicofSQL 5 ай бұрын
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.
@NuProg
@NuProg 4 ай бұрын
@@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?
@TheMagicofSQL
@TheMagicofSQL 4 ай бұрын
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)
@NuProg
@NuProg 4 ай бұрын
@@TheMagicofSQL Thanks again. I shall try this and will update here on how it goes.
@kevingergely2462
@kevingergely2462 4 жыл бұрын
This was awesome man thank you very much
@TheMagicofSQL
@TheMagicofSQL 4 жыл бұрын
You're welcome, glad you enjoyed this
@premjithtube
@premjithtube 3 жыл бұрын
How many index can create against a table?? Instead of creating index(color,shape), wat abt creating two separate indexs with these columns and use in the query?
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
You can create an index for each unique combination of columns and index properties. You can create a separate index on each column and the optimizer can scan each to find which rows to access. In general this is less efficient than one multi-column index though. If there's little/no correlation between colour and shape and each have four distinct values, finding all the rows for a (colour, shape) combo will get ~1/16 of the rows. With separate indexes, the database has read a quarter of the rows from each index. Then combine these to get down to the ~1/16 rows in the table. Whereas with the multicolumn index the database can just search the index to find these rows.
@premjithtube
@premjithtube 3 жыл бұрын
@@TheMagicofSQL thanku for ur reply sir. If i hav a txn table wit colmns txndate,branch,currency,country,bank. If i mak index wit txndate&branch, txndate&currency, txndate&country, txndate&bank den if i hav a query with where condition wit txndate, branch, bank. Wat wil be the impact?
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
It depends which the optimizer thinks is the best choice - it all comes down to the specifics of your data. Watch the other videos in this performance series to see what affects these decisions.
@crtt5k45
@crtt5k45 2 жыл бұрын
You really made my day :-)
@TheMagicofSQL
@TheMagicofSQL 2 жыл бұрын
You're welcome!
@LillyCode
@LillyCode 4 жыл бұрын
BRILLIANT thank you
@TheMagicofSQL
@TheMagicofSQL 4 жыл бұрын
You're welcome, glad this helped :)
@LillyCode
@LillyCode 4 жыл бұрын
@@TheMagicofSQL It did, thank you for the entertianment and education.
@LillyCode
@LillyCode 4 жыл бұрын
Or other way around.... education and entertainment!.. The fact that you explained it in a fun way, made it really fun!
@akadiryigit
@akadiryigit 3 жыл бұрын
Hi Chris, Thanks for sharing the video, It is easy to understand and I love it. :) Could you please answer my questions when you have time ? I have a question about differences between Partition and Index. When should we use Index or Partition ? Why should choose Partition instead of Index. Thanks,
@TheMagicofSQL
@TheMagicofSQL 3 жыл бұрын
This is a big topic, but broadly speaking: - You use an index to find a few rows - You partition a table to make massive tables easier to manage For more details on partitioning, see this guide from my colleague Connor asktom.oracle.com/partitioning-for-developers.htm
@HarrietOmboga
@HarrietOmboga 5 ай бұрын
I like how its explained though I dont get most of it
@TheMagicofSQL
@TheMagicofSQL 5 ай бұрын
What is it you're struggling to understand?
@sebon11
@sebon11 4 жыл бұрын
P.s. you're from UK or USA? Or even Australia maybe?
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 8 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 26 МЛН
How to Read an Execution Plan: Databases for Developers: Performance #1
9:34
Database Indexing for Dumb Developers
15:59
Laith Academy
Рет қаралды 74 М.
Using DBMS_XPLAN.DISPLAY_CURSOR to examine execution plans
12:33
Maria Colgan (SQLMaria)
Рет қаралды 36 М.
SQL Index |¦| Indexes in SQL |¦| Database Index
9:57
Socratica
Рет қаралды 623 М.
Database Indexing Explained (with PostgreSQL)
18:19
Hussein Nasser
Рет қаралды 319 М.
Explaining Explain Plans
59:59
Oracle Developers
Рет қаралды 41 М.
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН