Querying Flashcards
With default settings, how long will a query run on snowflake
Snowflake will cancel the query if it runs more than 48 hours
STATEMENT_TIMEOUT_IN_SECONDS
T/F Any query that uses the metadata repository does not consume any compute credit
True
T/F This statement would use the metadata repository
SELECT COUNT(UDEMY_ID) FROM SNOWFLAKE GROUP BY UDEMY_ID;
False, the Group by is the key
What is RESULT_SCAN
A system defined table function. To use in a create table query, use
from table(result_scan(last_query_id()))
When choosing a cluster key, what is reccomended
- Cluster columns that are most actively used in selective filters
- If there is room, columns frequently used in join predicates
What does the validation_mode=’RETURN_ROWS’ with the Copy Command do
helps to validate the data that is unloaded using the COPY INTO cmd
When would you consider adding a cluster key to a table
- The performance of a query has deteriorated over a period of time
- It is multi TB size
When do temporary tables expire
as soon as the session ends
T/F Transient tables do not have a fail safe period
True
Name four times Materialized views may be helpful
Query results contain a small number of rows and/or columns as compared to the original table
Query involves significant processing (aggregates, analysis of semi structured data)
Query is on an external table
View’s base table changes infrequently
When calling loadHistoryScan, how should you specify the time range
The most narrow time range that includes a set of data loads. For example, reading the last 10 minutes of history every 8 minutes
When creating a clustering key, what is the recommendation for the max number of columns
3 to 4
for COPY INTO, what are the copy options
ON_ERROR = { CONTINUE | SKIP_FILE | SKIP_FILE_<num> | 'SKIP_FILE_<num>%' | ABORT_STATEMENT }</num></num>
SIZE_LIMIT = <num> PURGE = TRUE | FALSE RETURN_FAILED_ONLY = TRUE | FALSE MATCH_BY_COLUMN_NAME = CASE_SENSITIVE | CASE_INSENSITIVE | NONE ENFORCE_LENGTH = TRUE | FALSE TRUNCATECOLUMNS = TRUE | FALSE FORCE = TRUE | FALSE LOAD_UNCERTAIN_FILES = TRUE | FALSE
What does the default behavior ON_ERROR = ABORT_STATEMENT do
aborts the load operation
What are the optional paramaters for COPY INTO
[ FILES = ( ‘<file_name>' [ , '<file_name>' ] [ , ... ] ) ]</file_name></file_name>
[ PATTERN = ‘<regex_pattern>' ]</regex_pattern>
[ FILE_FORMAT = ( { FORMAT_NAME = ‘[<namespace>.]<file_format_name>' |
TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]</file_format_name></namespace>
[ copyOptions ]
[ VALIDATION_MODE = RETURN_<n>_ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS ]</n>