Тёмный

Speed up MySQL 25-100x with Indexing 

AnotherMaker
Подписаться 16 тыс.
Просмотров 31 тыс.
50% 1

Today we will take a quick look at how to speed up a query on a database table with over 850,000 rows and see how indexing can take a query from minutes to seconds.

Опубликовано:

 

13 июн 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 41   
@mayurchavhan8590
@mayurchavhan8590 3 года назад
You've explained so well so please keep on coming like this video, It will help lot of people to save so much money on server costing.
@AnotherMaker
@AnotherMaker 3 года назад
Awesome! Glad it helped. I have another channel called Develop with Dan where I do a little bit more coding. I have some more database stuff coming.
@ElTrabajo88
@ElTrabajo88 4 месяца назад
Thank you so very much! Saved me a lot of time.
@KubaSobecki
@KubaSobecki Год назад
So glad I found this vid. Thank you!
@AnotherMaker
@AnotherMaker Год назад
Glad it was helpful!
@miguelbel93
@miguelbel93 2 года назад
You can tune the query with something like "SELECT id, SUM(price) AS INCOME FROM sales GROUP BY item, cashier" and add some "WHERE" conditions to filter just the items and/or cashier which you want (i.e WHERE cashier=5). What you are facing is a N+1 problem. If the query is processed in an asynchronous way that cannot be a problem but in your case is synchronous so you have to focus on fixing the N+1 and you can either optimize the query as I suggested or create a projection. 11s normally isn't acceptable for loading a webpage. Anyway a 4x gain in performance with just indexes is a good example of how powerful they can be.
@AnotherMaker
@AnotherMaker 2 года назад
Yeah. I wrote purposely bad data and queries to show the performance increase of the indexing itself. Since the indexing was the only thing that changed, it was a nice benchmark. But you are absolutely right.
@Amazongadgets563
@Amazongadgets563 Месяц назад
Многие проекты в наши дни очень хороши и неформальны для всех, спасибо, что организуете их для нас
@AnotherMaker
@AnotherMaker Месяц назад
Thank you!
@bowiemtl
@bowiemtl Год назад
Additionally I think the query would speed up immensely if you changed the loop from querying a thousand times into into building a single query that has a range in it. Queries in loops are a big no go in general
@ivinsons
@ivinsons 5 лет назад
Top Dam!!!! Tks for the tips!
@AnotherMaker
@AnotherMaker Год назад
Thanks for watching.
@IchBinDuck
@IchBinDuck Год назад
thank you so so much!
@AnotherMaker
@AnotherMaker Год назад
You are very welcome.
@ViralDriftOfficial
@ViralDriftOfficial 3 года назад
Can i make many indexes if i need to call large amount to a specific column?
@AnotherMaker
@AnotherMaker 3 года назад
Yes. I like to test them one or two at a time and see how the performance is on that query because sometimes you have diminishing returns
@theamanjs
@theamanjs 3 года назад
Is it bad if I index 7-8 out of 24 columns in the table? From which factor it will affect the database which have more than 300k rows of data in table? Can you please help me with it? Thanks in advance
@AnotherMaker
@AnotherMaker 3 года назад
I like to add one at a time and test how much of a performance benefit I get. you may find that some things you think will help will actually slow it down
@theamanjs
@theamanjs 3 года назад
@@AnotherMaker thank you mate. I tried it and got stunning results. I was just worried about its cons of this and I read about it that it creates a little mess for manipulation operations (insert, update, etc) Thank you 😊
@BsiennKhan
@BsiennKhan 3 года назад
Don't run queries inside loop, instant performance boost. Bonus: use composite index(cashier, item), super instant performance boost.
@AnotherMaker
@AnotherMaker 3 года назад
Good tip!
@epicgameryt4052
@epicgameryt4052 Год назад
+100 Composite indexes are heavily underrated.
@turalrzaxanov4373
@turalrzaxanov4373 3 года назад
thanks bro.
@AnotherMaker
@AnotherMaker 3 года назад
You're welcome!
@didinkhoerul4831
@didinkhoerul4831 2 года назад
can this be used in VB applications ?
@AnotherMaker
@AnotherMaker 2 года назад
Absolutely!
@MdRakib-rc6ub
@MdRakib-rc6ub Год назад
Can you optimize my script where quickly search queries from 30 billion recoreds mysql php? My now codes are simple .
@AnotherMaker
@AnotherMaker Год назад
Sure. Post your query. Make a new comment because RU-vidrs do not see replies to comments
@salehmohammednasseralobidi5880
@salehmohammednasseralobidi5880 2 года назад
Video not complete what is next step
@AnotherMaker
@AnotherMaker 2 года назад
It's complete. That's all you had to do.
@markbarry9945
@markbarry9945 6 месяцев назад
Now, try adding an "ORDER BY" clause and see how slow it gets
@AnotherMaker
@AnotherMaker 6 месяцев назад
Order by will always slow it at least a little.
@markbarry9945
@markbarry9945 6 месяцев назад
@@AnotherMaker make sure you index the column that you're ordering by
@tapankarmakar4071
@tapankarmakar4071 2 года назад
plz zoom view unable to view from mobile
@AnotherMaker
@AnotherMaker 2 года назад
Sorry. I started doing that in more recent videos.
@pjmclenon
@pjmclenon Год назад
Hello post your link to code and itgers in comments Have a nice day Lisa
@AnotherMaker
@AnotherMaker Год назад
Hi. I'm sorry. I don't think I have it saved anymore.
@pjmclenon
@pjmclenon Год назад
ok thank you
@korsbar1978
@korsbar1978 2 года назад
The code is way too small I can't see anything.
@AnotherMaker
@AnotherMaker 2 года назад
I've fixed that in newer videos.
@AnotherMaker
@AnotherMaker 2 года назад
Sorry about that though
Далее
SQL Index |¦| Indexes in SQL |¦| Database Index
9:57
50 YouTubers Fight For $1,000,000
41:27
Просмотров 63 млн
Speed up your MySQL database with the buffer pool
9:24
10 Tips for MySQL Performance Tuning
24:12
Просмотров 8 тыс.
Massively Speed-Up SQL Queries with Indexes
14:42
Просмотров 8 тыс.
Database Indexing for Dumb Developers
15:59
Просмотров 45 тыс.
Make your database queries 1000 times faster!
11:36
Просмотров 49 тыс.
How can I speed up a query if an index cannot help?
8:20
SQL Indexes - Definition, Examples, and Tips
12:14
Просмотров 71 тыс.