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?"
Practice
Reader Account in Snowflake?Solution
Step 1: Understand the role of Reader Accounts
Reader accounts are designed to let users without Snowflake accounts access shared data safely.Step 2: Compare options with this purpose
The options for monitoring usage, creating backups, and managing user permissions describe other Snowflake features unrelated to Reader Accounts.Final Answer:
To allow non-Snowflake users to access shared data securely -> Option BQuick Check:
Reader Account purpose = secure data access for non-users [OK]
- Confusing Reader accounts with user management
- Thinking Reader accounts are for backups
- Assuming Reader accounts monitor billing
Solution
Step 1: Recall the correct syntax for creating Reader Accounts
The correct command isCREATE READER ACCOUNT ... FROM SHARE ...followed by parameters.Step 2: Eliminate incorrect syntax options
Only CREATE READER ACCOUNT FROM SHARE matches the correct syntax including the FROM SHARE clause.Final Answer:
CREATE READER ACCOUNT FROM SHARE -> Option CQuick Check:
Command to create Reader Account from share = CREATE READER ACCOUNT FROM SHARE [OK]
- Omitting FROM SHARE clause
- Swapping word order
- Combining CREATE and SHARE incorrectly
CREATE READER ACCOUNT partner_reader FROM SHARE partner_share;
What is the expected result of this command?
Solution
Step 1: Analyze the CREATE READER ACCOUNT command
This command creates a new reader account named partner_reader that can access data shared via partner_share.Step 2: Understand the relationship between reader account and share
The reader account is a new Snowflake account for external users, linked to the existing share.Final Answer:
Creates a new Snowflake account named partner_reader with access to partner_share data -> Option DQuick Check:
CREATE READER ACCOUNT creates account with share access [OK]
- Confusing share creation with reader account creation
- Thinking the share is deleted
- Mixing up grant and create commands
CREATE READER ACCOUNT my_reader FROM SHARE;
But get an error. What is the likely cause?
Solution
Step 1: Check the command syntax
The command must specify the share name after FROM SHARE. Here, it is missing.Step 2: Verify other options
Reader accounts can be created from shares, no USING keyword is needed, and underscores are allowed in names.Final Answer:
Missing share name after FROM SHARE -> Option AQuick Check:
FROM SHARE must be followed by share name [OK]
- Omitting share name
- Adding unnecessary keywords
- Assuming naming restrictions that don't exist
Solution
Step 1: Understand Reader Account workflow
First, create a share containing the data to share.Step 2: Create a Reader Account from the share
This creates a Snowflake account for the partner to access the shared data without needing their own account.Step 3: Evaluate other options
Create a Reader Account first, then create a share inside that account reverses the order incorrectly; C requires partner to have an account; D is manual and not using Snowflake features.Final Answer:
Create a share with the data, then create a Reader Account from that share for the partner -> Option AQuick Check:
Share data first, then create Reader Account [OK]
- Creating Reader Account before share
- Assuming partner must have Snowflake account
- Using manual data export instead of Reader Account
Ready to prove it?
Pass the test and this pattern moves unknown
