Does RedShift support compilation cache for similar queries, how?

0

I read the RedShift Paper: [https://assets.amazon.science/93/e0/a347021a4c6fbbccd5a056580d00/sigmod22-redshift-reinvented.pdf] (redshfit re-invented). In chapter 2.6 Compilation Service:

When the same or similar queries are executed, the compiled segments are reused from the cluster code compilation cache

I'm wondering how to identify similar queries?

A query with only parameters different is identified as similar queries?

e.g.

query1: select c1, sum(v1) from t where c2='AAA' group by c1; 
query2: select c1, sum(v1) from t where c2='BBB' group by c1; 
query3: select c1, sum(v1) from t where c2 in ('AAA') group by c1; 

query2 is similar to query1, but query3 is not similar to query1?

Any help would be appreciated!

질문됨 7달 전335회 조회
2개 답변
1
수락된 답변

Hi stanleyhunju,

There is no defined or specific list of conditions for similar queries. In your example, query 3 is considered similar to query 1 since they are searching for the same results or dataset but in a slightly different way. If you first execute query 1 and then query 3, query 3 in this case will use the result cache.

I usually use the system view SVL_COMPILE to analyze the compilation phase of queries.

Regards, Ziad

AWS
전문가
Ziad
답변함 7달 전
profile picture
전문가
검토됨 7달 전
1

Redshift query engine can rewrite the queries before execution. It will see that query 3 is similar to query 1 and can be rewritten to match it. Thus it can still leverage the compile cache for query 3.

profile pictureAWS
답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠