Snowflake+Interview+Questions+ +Part+I
Snowflake+Interview+Questions+ +Part+I
Part I
By
Janardhan Bandi
1. What is Snowflake and what kind of Database it is?
Snowflake is pure SQL database, it organizes the data into multiple micro
partitions that are internally optimized and compressed. It uses a columnar
format to store.
2. Explain the architecture of Snowflake.
Ans: Snowflake Stages are the locations where data files are stored
There are 2 types of stages in Snowflake.
External Stages: If the data that needs to be loaded into Snowflake is stored in other
cloud regions like AWS S3 or Azure or GCP then then we can use External Stages.
Internal Stages: Stores the Data files internally, we can copy files to Internal stages by
using PUT command from Snowsql.
5. Write the syntax of a Copy command to load a file into
snowflake table.
Ans:
6. Can you use Where clause in Copy command?
But We can do some transformations while loading the data by using copy.
→ Select only required fields
→ Can use functions like substring, cast etc.
→ Can use Case statement
7. How can you load a json file to Snowflake?
(or) how can you process and load semi-structured data?
Ans: We can store this semi-structure data into a table by using a data type
called ‘Variant’. Then we can read this data from Variant, we can process it into
rows and columns and load it into another table.
→ Storage Cost
→ Compute Cost
Note: I have clearly explained how both of these costs calculated in below video.
https://youtu.be/0uJ2s0JS7SI
11. What is a clustering in Snowflake?
We define cluster keys on big tables, below are the best practices to define
cluster keys.
→ Don’t define on small tables
→ Define on filter columns
→ Define on join keys
→ Define on function based columns
We can define cluster keys at the time creating tables, also we can add or modify
cluster keys by using Alter Statement.
12. How many cluster keys is advised on single table?
Ans:
14. What are all the objects we can restore after delete or drop?
Ans:
We can restore the deleted data from any table based on the Time Travel
Retention Period defined on the table. Based on the edition of snowflake,
retention period can be 1 to 90 days.
We can un-drop the tables, schemas and databases that were dropped by
mistake or wantedly.
15. Write a query to create a table with previous version of
another table.
(or) Write a query for Clone with Time Travel.
Ans:
16. What are all the objects that can be cloned in Snowflake?
Ans: Below objects can be cloned in Snowflake.
Data Containment Objects
• Databases
• Schemas
• Tables
• Streams
Data Configuration and Transformation Objects
• Stages
• File Formats
• Sequences
• Tasks
17. What are Secure Views in Snowflake?
Ans:
If we define the views with secure keyword then unauthorized users can’t see
the definition of views using GET_DDL, SHOW VIEWS, DESC commands.
• Tables.
• External tables.
• Secure views.
• Secure materialized views.
• Secure UDFs.
19. What is a materialized view in Snowflake?
Ans: Star schema contains a fact table and the dimension tables
those are denormalized but the snowflake schema contains a fact
table and may be normalized dimension tables.
When it comes to performance in snowflake schema there will be
more number of joins when compared to star schema because of
its normalized dimension tables. So Start schema gives better
performance.
22. What is the retention period in Business critical edition
and how can you increase or reduce it?
2. Database Level:
use role accountadmin;
grant usage on database dbname to role role_name;
grant usage on future schemas in database dbname to role role_name;
grant select on future tables in database dbname to role role_name;
Thank You!
janardhan520@gmail.com
https://www.youtube.com/channel/UCNTGAQaxJMxZLS0GR1VHOKg