Reputation: 283
I am wondering if anyone has optimized a Snowflake table to support transactional type queries and the steps you took.
Example Table:
CHILD_ID | PARENT_ID |
---|---|
1 | 9 |
2 | 9 |
3 | 4 |
Example Query:
SELECT PARENT_ID
FROM TABLE
WHERE CHILD_ID = 1
What would be the best way to run these types of queries? Should I do a clustering key on CHILD_ID? Should I have these queries run on an XS warehouse? In the query profile, it seems like most of the time is spent on Initialization.
Upvotes: 0
Views: 565
Reputation: 466
Unless you're doing just a rewrite to optimize your query, a more detailed analysis is necessary if you're looking to apply features like Automatic Clustering as it will not only affect a single query but possibly all queries accessing the table. It is not something that one would recommend after seeing only a single use case of a table.
Although in the above case, Search Optimization Service seems to be the more appropriate solution. I've summarized Snowflake's query tuning options below and I think it can give you some ideas: https://medium.com/snowflake/snowflake-accelerate-query-performance-767663b0e5b7
Upvotes: 1