Reader accounts for non-Snowflake users - Time & Space Complexity
We want to understand how the work grows when using reader accounts for users outside Snowflake.
Specifically, how does the number of operations change as more external users access data?
Analyze the time complexity of this sequence creating and using reader accounts.
CREATE READER ACCOUNT reader_acc;
GRANT USAGE ON DATABASE sales_db TO READER ACCOUNT reader_acc;
-- External user connects using reader_acc
SELECT * FROM sales_db.public.orders;
-- Repeat for multiple external users
This sequence sets up a reader account and external users query data through it.
Look at what happens repeatedly when many external users access data.
- Primary operation: External queries through the reader account.
- How many times: Once per external user query.
As more external users query data, the number of queries grows directly with users.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 queries through reader account |
| 100 | 100 queries through reader account |
| 1000 | 1000 queries through reader account |
Pattern observation: The work grows in a straight line as users increase.
Time Complexity: O(n)
This means the number of operations grows directly with the number of external users querying data.
[X] Wrong: "Adding more external users does not increase query operations because they share the same reader account."
[OK] Correct: Each external user runs their own queries, so the total queries increase with users, even if the reader account is shared.
Understanding how external user queries scale helps you design data sharing solutions that handle growth smoothly.
"What if each external user had their own reader account instead of sharing one? How would the time complexity change?"