notexOPENOverview
Notex/Systems/Query service
13.06LESSON 06 OF 13 · 1 MIN READ

Query service

Always free to read
SECTION VIDEOQuery service

Video coming soon. Start with the reading below.

COMING SOON

Assume we have a frequency table as shown in Table 13-1. It has two fields.

  • Query: it stores the query string.
  • Frequency: it represents the number of times a query has been searched.
Design a search autocomplete system — original diagram 166

When a user types “tw” in the search box, the following top 5 searched queries are displayed (Figure 13-3), assuming the frequency table is based on Table 13-1.

Design a search autocomplete system — original diagram 167

To get top 5 frequently searched queries, execute the following SQL query:

Design a search autocomplete system — original diagram 168

This is an acceptable solution when the data set is small. When it is large, accessing the database becomes a bottleneck. We will explore optimizations in deep dive.

Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K