SnowPro Advanced: Data Engineer — Question 47
A Data Engineer enables a result cache at the session level with the following command:
ALTER SESSION SET USE_CACHED_RESULT = TRUE;
The Engineer then runs the following SELECT query twice without delay:
SELECT *
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER
SAMPLE(10) SEED (99);
The underlying table does not change between executions.
What are the results of both runs?
Answer options
- A. The first and second run returned the same results, because SAMPLE is deterministic.
- B. The first and second run returned the same results, because the specific SEED value was provided.
- C. The first and second run returned different results, because the query is evaluated each time it is run.
- D. The first and second run returned different results, because the query uses * instead of an explicit column list.
Correct answer: B
Explanation
The correct answer is B because the SEED value of 99 ensures that the SAMPLE function produces the same set of results on each execution when the underlying data does not change. Option A is incorrect because while SAMPLE is deterministic with a specific SEED, it does not imply that all executions will yield the same results without the SEED. Options C and D are incorrect as they suggest variability in results that does not apply with the specified SEED.