Database / Snowflake Interview Questions
What is the metadata cache (Cloud Services layer cache) and how does it speed up queries?
The metadata cache lives entirely within the Cloud Services layer and is separate from both the result cache and the local SSD cache on Virtual Warehouse nodes. It stores structural and statistical information about every micro-partition for every table: per-column minimum and maximum values, null counts, row counts, and approximate distinct value counts. This metadata is updated in real time as data is loaded, inserted, or deleted.
The metadata cache serves two critical performance functions. First, the query optimizer reads it before any data scan begins, using column min/max ranges to decide which micro-partitions are irrelevant to the predicate (partition pruning) — this happens entirely within Cloud Services and costs no warehouse credits. Second, certain queries can be answered completely from metadata without reading a single data file, consuming zero compute credits:
SELECT COUNT(*) FROM orders— answered from stored row count.SELECT MIN(order_date), MAX(order_date) FROM orders— answered from stored min/max.SELECT COUNT(DISTINCT region) FROM orders(approximate) — can use HLL sketches.- Schema queries:
DESCRIBE TABLE,SHOW TABLES.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
