How Instagram efficiently serves HashTags ordered by count

  Рет қаралды 17,817

Arpit Bhayani

Arpit Bhayani

Күн бұрын

Пікірлер: 64
@rahulsarkar4206
@rahulsarkar4206 Жыл бұрын
Man, you are next level. Your chanel is a binge watch for engineers.
@dipankarkumarsingh
@dipankarkumarsingh Жыл бұрын
Finished ✅ ... ( Self Note ) : New Learning: 1) It's great to see the query execution plan .. an insight can help a lot in optimization ( till now I just knew the query execution plan in theory ... How to access it was new to me ) 2) partial Indexing can effectively be used in tail graph ... The idea of partial Indexing is similar to Heavy Light Decomposition ( CP Background) ( it is used in graph ) so yeah .. cool to see a idea getting implemented in lite version and gaining Huge performance. Now I think ... I can try to use Heavy Light Decomposition in Vector databases 🤔 (a must try 😁 thing )
@xskrish
@xskrish 2 жыл бұрын
5:31 "this is the beauty of Instagram, they never optimise" - truth has been spoken 😅
@AsliEngineering
@AsliEngineering 2 жыл бұрын
I admire them for this. They keep things extremely simple. Simple systems scale.
@okcodingbeast
@okcodingbeast 11 ай бұрын
Hi Arpit, your approach to engineering is truly inspiring. Despite the intimidating jargon like Partial Indexes, distributed transactions, etc, your emphasis on first principles makes Computer Science feel like Common Sense. Keep up the great work and continue to inspire us. Thanks!
@rajatiitr
@rajatiitr 2 жыл бұрын
I AM LATE TO FIND THIS CHANNEL, BUT LUCKY..... THIS IS ASLI ENGINEERING CHANNEL. THANKS ARPIT SIR FOR PROVIDING SUCH CONTENT.
@j-stormz5472
@j-stormz5472 Жыл бұрын
I’m really feeling lucky to have found your channel. Keep up the good work !
@Jagrati
@Jagrati 2 ай бұрын
Interesting pick and very well explained..love how in your teaching you start from basics and build up to the concept!!
@tawseefbhat977
@tawseefbhat977 2 жыл бұрын
as always concise n effective.. love it
@teetanrobotics5363
@teetanrobotics5363 2 жыл бұрын
Hey, this course is not for beginner-friendly. The first video provided an intro but from the next video onwards we went straight into partial indexing which most people aren't aware of. If possible, could you also insert some basic videos, just to get the audience up to speed. Thanks for the amazing explanations though. You're extremely knowledgable and a great presenter.
@dennysam829
@dennysam829 2 жыл бұрын
Amazing way of explaining!
@shantanutripathi
@shantanutripathi 2 жыл бұрын
That's a perfect usecase for Partial Indexing! Great Video.
@MohitSharma-yu2gt
@MohitSharma-yu2gt 2 жыл бұрын
Brilliant Insights 🙌
@shishirchaurasiya7374
@shishirchaurasiya7374 Жыл бұрын
Got some really nice insights from the topic explained Arpit sir you are really amazing in explaining and breaking down hard things into simpler chunks
@utkarshshrivastav700
@utkarshshrivastav700 2 жыл бұрын
GEM. Thanks for such awesome and mindblowing content.
@kjgopika8936
@kjgopika8936 2 жыл бұрын
Thanks for this video.
@yadneshkhode3091
@yadneshkhode3091 2 жыл бұрын
Thank you for providing good content ❤️👍
@piyushverma1219
@piyushverma1219 2 жыл бұрын
Simple yet so effective
@atishayjain5321
@atishayjain5321 Жыл бұрын
hii arpit bhaiya can you please make the video on collaborative software like git automerge how they works?
@AsliEngineering
@AsliEngineering Жыл бұрын
There is a podcast coming on Collaborative Editors 2 weeks from now. You can find it on my channel home page.
@gokulyc
@gokulyc 10 ай бұрын
Good explanation. source link?
@AsliEngineering
@AsliEngineering 10 ай бұрын
Instagram engineering blog.
@gaurangmittal5563
@gaurangmittal5563 Жыл бұрын
Hi Arpit bhaiya saw this video and even read the medium article, i just had one question , the article content is 10 years old, do you still think they will be using the same optimization techniques on the hashtags services or it could have changed by now.
@AsliEngineering
@AsliEngineering Жыл бұрын
does that even matter? what matters is the key concept we learned from it.
@lakshjain6959
@lakshjain6959 9 ай бұрын
Do we have something similar to partial indexing in SQL server?
@akash-kumar737
@akash-kumar737 2 жыл бұрын
Thanks man I am about to work on a product and was stuck at autocomplete feature. Was looking to go with custom solution but now will use this feature of Postgresql. 😊
@oshogarg5215
@oshogarg5215 2 жыл бұрын
very good explanation but as a beginner I dont know about what are indexing , partial indexing in database ... will figure it out through Google , thanks.
@saifulhasan2532
@saifulhasan2532 11 ай бұрын
What if we can have another boolean column which tell us whether hashtag popular or not. Default value of this column is false but Whenever hashtag count value reached to certain threshold(in this case 100) then it will update to true. What is pros and cons of this method over the partial indexing?
@5590priyank
@5590priyank Жыл бұрын
Is it same as functional indexes?
@ammarejaz824
@ammarejaz824 16 күн бұрын
Sir, I'm curious about what would happen if the media count is less than 100. If there's no index for that, wouldn't there be a problem?
@AsliEngineering
@AsliEngineering 16 күн бұрын
They are not serving for those hashtags. No person would be interested in looking up hashtags with count less than 100.
@nehagour6928
@nehagour6928 2 жыл бұрын
Such an amazing optimisation Instagram applied , Arpit brilliant insights
@ankurbansal18
@ankurbansal18 Жыл бұрын
Bhaiya What if I want to seach a tag with media < 100 ? (Like what if its not a popular tag and is a part of long tail)
@AmanGupta-fb1fz
@AmanGupta-fb1fz 2 жыл бұрын
Hi, instead of creating a new partial index, what if they would have fired the sql query with count >= 100 filter directly? That would also sort around 169 rows only, right? Won't that be similar in performance as with partial indexes.
@AsliEngineering
@AsliEngineering 2 жыл бұрын
No. Because to power that you would have to create index on all data and that would make it bulky because of the long tail putting a stress on the database.
@prasathkrish924
@prasathkrish924 2 жыл бұрын
@@AsliEngineering Didn't the where works first, so after filtering the count>=100, there will only be 169 rows. So sorting only those rows is just enough right? Asking out of curiosity
@balasravandindukurthi4702
@balasravandindukurthi4702 Жыл бұрын
@Aman, @Prasanth - I think Arpit's point here is to support the range queries efficiently you would have to create index on the table. Lets say you create index on all the rows then the index would be huge resulting in stress on database. Since we anyways want to show top hashtags only we can index on only rows that have high media count. This is what we call as partial index (creating index only on subset of rows that matches our filter criteria)
@pankajvermacr7
@pankajvermacr7 10 ай бұрын
hey, is there a way to achieve this in Other Databases like MySQL, or MongoDB ?
@AsliEngineering
@AsliEngineering 10 ай бұрын
Mongo does support partial index but MySQL does not.
@adityasanthosh702
@adityasanthosh702 Жыл бұрын
Why did MySQL did not implement Partial Indexing? Also, can you compare between MySQL and PostgreSQL? What is the better database of those two
@AsliEngineering
@AsliEngineering Жыл бұрын
both has some advantages and disadvantages. more than performance there are a ton of other factors that decides which one is picked.
@nishaaa_maurya
@nishaaa_maurya 8 ай бұрын
If Instagram first sort on the basis of media_count. So, sorting on the basis of media count will not take heavy resource ? If not, please explain, It would be a great help. Thank You !!
@AsliEngineering
@AsliEngineering 8 ай бұрын
Sorting is an extremely expensive operation. Even keeping a secondary index that is ordered by this ever changing attribute will lead to multiple tree rebalances degrading the database performance.
@5590priyank
@5590priyank Жыл бұрын
So if we create partial index with >100, if our query has >500 then also database would be smart enough to reuse above index?
@kamalhm-dev
@kamalhm-dev Жыл бұрын
Yes, because it's a subset of >100, it will also work if you use >1000 or even bigger
@venkatamunnangi1287
@venkatamunnangi1287 2 ай бұрын
Why not run a flink stream processor and store it in a sorted set. Then, return the top 5 trending?
@AsliEngineering
@AsliEngineering 2 ай бұрын
Yes. You can do that. But Instagram, during their initial days, went ahead with a simpler solution that can be shipped faster. This is from around 2015.
@venkatamunnangi1287
@venkatamunnangi1287 2 ай бұрын
@@AsliEngineering Yea thats what i figured. Thanks!
@SaketAnandPage
@SaketAnandPage Жыл бұрын
How the new tags which entered the count > 100 will get indexed?
@AsliEngineering
@AsliEngineering Жыл бұрын
Upon every update the database will see if an index needs to be updated or not. So partial indexes (like regular indexes) will be kept updated upon every commit.
@SaketAnandPage
@SaketAnandPage Жыл бұрын
Thanks @@AsliEngineering
@mahendars1417
@mahendars1417 10 ай бұрын
Can we not just say include only those tags where media count is greater than 100 in the original query ??? I'm not great with databases, please forgive my naive question.
@random4573
@random4573 2 жыл бұрын
What is the cost of keeping index upto to date??
@AsliEngineering
@AsliEngineering 2 жыл бұрын
Nothing extra. It operates like a regular index just with an added filter.
@VM-ue6hu
@VM-ue6hu Жыл бұрын
too good !!!
@anishkelkar6434
@anishkelkar6434 2 жыл бұрын
The prices in the video shown are around 15% lower than the actual price offered on the website! Is there any discount code which we can encash?
@AsliEngineering
@AsliEngineering 2 жыл бұрын
They are old promotion videos. Yet to record the new one. Will be recording the new one today. There is no discount. I feel they are unfair to people who paid in full.
@rjphotos2393
@rjphotos2393 2 жыл бұрын
Isn't the article 10 yrs old? Are they still using these techniques?
@AsliEngineering
@AsliEngineering 2 жыл бұрын
I don't know if they are using the same technique or not. Most probably not but the optimization was pretty cool. It shows how partial indexes can be used to power queries over long tail distribution.
@rjphotos2393
@rjphotos2393 2 жыл бұрын
@@AsliEngineering Yup, true that!
@raj_kundalia
@raj_kundalia Жыл бұрын
interesting
@dpm-07
@dpm-07 2 жыл бұрын
Most awaited video. after watching this video 'itni kushi ..... intni kushi....' ref: kzbin.info/www/bejne/nYTPgWpnmt2VprM
@dpm-07
@dpm-07 2 жыл бұрын
please make a video on heavy hitters with Twitter trending Example. Many of us has doubts related to scaling, choosing right ds or db. or how you can in prove those ....
An engineering deep-dive into Atlassian's Mega Outage of April 2022
31:24
Database Sharding and Partitioning
23:53
Arpit Bhayani
Рет қаралды 99 М.
SIZE DOESN’T MATTER @benjaminjiujitsu
00:46
Natan por Aí
Рет қаралды 7 МЛН
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 39 МЛН
How Razorpay scaled their notification system
17:32
Arpit Bhayani
Рет қаралды 22 М.
How Flipkart made their type ahead search hyper personalized
19:00
Arpit Bhayani
Рет қаралды 15 М.
How Gojek masks and keeps users' phone numbers secure at scale?
16:21
How do indexes make databases read faster?
23:25
Arpit Bhayani
Рет қаралды 74 М.
Design Twitter - System Design Interview
26:16
NeetCode
Рет қаралды 531 М.
Why, where, and when should we throttle or rate limit?
19:05
Arpit Bhayani
Рет қаралды 15 М.
Instagram System Design | Meta | Facebook
16:38
ByteMonk
Рет қаралды 43 М.
7 Must-know Strategies to Scale Your Database
8:42
ByteByteGo
Рет қаралды 131 М.