Querying Flashcards

1
Q

With default settings, how long will a query run on snowflake

A

Snowflake will cancel the query if it runs more than 48 hours
STATEMENT_TIMEOUT_IN_SECONDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

T/F Any query that uses the metadata repository does not consume any compute credit

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F This statement would use the metadata repository
SELECT COUNT(UDEMY_ID) FROM SNOWFLAKE GROUP BY UDEMY_ID;

A

False, the Group by is the key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is RESULT_SCAN

A

A system defined table function. To use in a create table query, use
from table(result_scan(last_query_id()))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When choosing a cluster key, what is reccomended

A
  • Cluster columns that are most actively used in selective filters
  • If there is room, columns frequently used in join predicates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the validation_mode=’RETURN_ROWS’ with the Copy Command do

A

helps to validate the data that is unloaded using the COPY INTO cmd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When would you consider adding a cluster key to a table

A
  • The performance of a query has deteriorated over a period of time
  • It is multi TB size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When do temporary tables expire

A

as soon as the session ends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

T/F Transient tables do not have a fail safe period

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Name four times Materialized views may be helpful

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When calling loadHistoryScan, how should you specify the time range

A

The most narrow time range that includes a set of data loads. For example, reading the last 10 minutes of history every 8 minutes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When creating a clustering key, what is the recommendation for the max number of columns

A

3 to 4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

for COPY INTO, what are the copy options

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the default behavior ON_ERROR = ABORT_STATEMENT do

A

aborts the load operation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the optional paramaters for COPY INTO

A

[ 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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does ENCRYPT do

A

Encrypts a varchar or binary value using a varchar passphrase

ENCRYPT( <value_to_encrypt> , <passphrase> ,
[ [ <additional_authenticated_data> , ] <encryption_method> ]
)</encryption_method></additional_authenticated_data></passphrase></value_to_encrypt>

17
Q

What does ENCRYPT return

A

Binary made up of Two or Three concatenated fields:
an initialization vector
the ciphertext
If the encryption mode is AEAD-enabled, then the AEAD tag.

18
Q

T/F To decrypt data encrypted by ENCRYPT(), use DECRYPT(). Do not use DECRYPT_RAW().

A

True

19
Q

What is the size recommended for the catchphrase in ENCRYPT

A

at least 8 bytes
follow general best practices for passwords, such as using a mix of uppercase letters, lowercase letters, numbers, and punctuation.