Perf. Concepts: Query Optimization Flashcards

(26 cards)

1
Q

What does the History tab display?

A

Query history for past 14 days

Users can view other users’ queries but cannot view their query results.

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

What are the components of the Db Order of Execution?

A

Rows - FROM, JOIN, WHERE
Groups - GROUP BY, HAVING
Result - SELECT, DISTINCT, ORDER BY, LIMIT

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

What is ‘Join Explosion’?

A

A situation where excessive joins lead to a significant increase in the size of the result set.

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

What does ‘Spilling to Disk’ refer to?

A

Bytes spilled to location / remote storage

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

What is a key consideration for using Group By?

A

Consider cardinality. If too high, maybe not a good group by.

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

What is a Metadata cache?

A

Highly available metadata store which maintains metadata object info and stats

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

What types of queries can be completed using metadata without requiring a VW?

A
  • SELECT COUNT(*)
  • SELECT SYSTEM$WHITELIST()
  • SELECT CURRENT_DATABASE_()
  • DESCRIBE TABLE
  • SHOW TABLES
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the Results Cache duration?

A

24 hr / 31 days

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

What must a new query do to reuse results from the Results Cache?

A

Must exactly match the previous query conditions

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

What are the conditions for using the Results Cache?

A
  • Underlying table data has not changed
  • Same role is used in previous query
  • Time context functions like CURRENT_TIME() cannot be used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Warehouse Cache also known as?

A

SSD cache, data cache, raw data cache

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

What does Local Disk Cache improve?

A

Performance by reading from cache instead of slower remote blob storage

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

What is a Materialized View (MV)?

A

A pre-computed & persisted dataset derived from a SELECT query

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

How are MVs updated?

A

Via a background process ensuring data is current and consistent with the base table

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

What is not recommended for Materialized Views?

A

Creating MVs on data with high churn

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

What are the limitations of Materialized Views?

A
  • Single table
  • JOIN
  • UDF
  • HAVING
  • ORDER BY
  • LIMIT
  • WINDOW FUNCTIONS
17
Q

What does Clustering improve?

A

Micro-partition pruning

18
Q

What clustering metadata does Snowflake maintain?

A
  • Total # of Micro-partitions
  • # of Overlapping micro-partitions
  • Depth of overlapping micro-partitions
19
Q

What is Automatic Clustering?

A

Specifying one or more table columns/expressions as clustering key for a table

20
Q

What does clustering aim to do?

A

Co-locate data of the clustering key in the same micro-partition

21
Q

What is recommended for choosing a Clustering Key?

A

A max of 3 or 4 columns

22
Q

What happens to a clustered table as DML operations are performed?

A

The table becomes less clustered

23
Q

What is re-clustering?

A

A background process which reorganizes data into micro-partitions by the clustering key

24
Q

What is the Search Optimization Service?

A

A table level property aimed at improving performance of selective point lookup queries

25
What does the Search Optimization Service require?
Enterprise edition and higher
26
What is the cost associated with the Search Optimization Service?
10 credits per snowflake managed compute hour