Design a query-retrieval system

Start Timer

0:00:00

Upvote
0
Downvote
Save question
Mark as completed
View comments

You are working on a Snowflake-like analytics platform that stores query history for enterprise customers. Product managers want a feature that lets users search past queries by text, filter by metadata, and retrieve the most relevant results quickly.

Design a query-retrieval system that supports the following requirements:

  1. Users can search by keywords appearing in the SQL text, for example join, customer_id, or date_trunc.
  2. Users can filter by user_id, warehouse_name, start_time and end_time, and status such as SUCCESS, FAILED, or CANCELLED.
  3. Results should be ranked by relevance, with exact keyword matches ranked higher than partial matches.
  4. The system should return the top k results, sorted by relevance and then by most recent execution time.
  5. The system must scale to billions of query records and support low-latency search.
.
.
.
.
.


Comments

Loading comments