Try Data Engineering in Python with Snowpark in Just 10 Minutes [new feature]
SnowPro Core Certification: Performance Concepts (3/8)
SnowPro Core Certification: Performance Concepts (3/8)
✅Performance
Snowflake's unique architecture and the underlying micro-partitions storage technology mean it is not required to perform much query tuning in most situations. There are, however, several performance improvement approaches that are available and are used to increase Snowflake's overall performance.
These include · Internal caching mechanisms that operate transparently in the background to increase performance. · Scaling up or increasing the capacity of a virtual warehouse to allow for more processing power to be available for complex queries · Horizontal scaling by increasing the capacity by using a multi-cluster virtual warehouse to handle a large number of concurrent users and concurrent queries · Automatic static and dynamic partition pruning can reduce unneeded partitions while processing a query. · It is possible to accomplish better partition pruning by redistributing data in micro-partitions using clustering keys. · Pre-computing results of complex, regularly executed queries by using materialized views. · Using Search Optimization services to improve the performance of specific types of lookup queries
✅query profile
✅Micro-partitions
Micro-partitions are small and typically store 50 MB to 500 MB of uncompressed data. https://docs.snowflake.com/en/user-guide/tables-clustering-micropartitions.html
In other words, the closer the ratio of scanned micro-partitions and columnar data is to the ratio of actual data selected (to the total columnar data), the more efficient is the pruning performed on the table.
Snowflake saves data on the warehouse's local disk if it can't fit an operation into memory. Data spilling slows down queries because it requires more IO operations, and disk access is slower than memory access. "Bytes spilled to local storage." indicates local spillage. Snowflake will spill data to remote cloud storage if the local disk becomes full, which is even slower storage than the local disk, making this operation even slower. "Bytes spilled to remote storage" in the query profile indicates remote spillage.
One of the ways to avoid spilling is to use a larger warehouse, which will increase the overall available RAM, local storage, and parallelism and might be able to fit the query in memory. https://docs.snowflake.com/en/user-guide/ui-query-profile#queries-too-large-to-fit-in-memory
✅clustering
Python中的变量类型转换
Python中的变量类型转换
⏩类型转换四个函数 int() float() str() bool()
👉int() 可以用来将其他的对象转换为整型
规则:
# 布尔值:True -> 1 False -> 0# 浮点数:直接取整,省略小数点后的内容# 字符串:合法的整数字符串,直接转换为对应的数字# 如果不是一个合法的整数字符串,则报错 ValueError: invalid literal for int() with base 10: '11.5'如果是其它base,需要多加一个base参数来转换,例如:print(int('0x123',16))print(int('0o123',8))
👉float() 和 int()基本一致,不同的是它会将对象转换为浮点数
👉str() 可以将对象转换为字符串
# True -> 'True'# False -> 'False'# 123 -> '123'
👉 bool() 可以将对象转换为布尔值,任何对象都可以转换为布尔值
# 规则:对于所有表示空性的对象都会转换为False,其余的转换为True# 哪些表示的空性:0 、 None 、 '' 。。。
👉用type进行类型检查
print(type(a))
Featured Posts
SnowPro Badges and Certificates
SnowPro Badges and Certificates Online Verification https://achieve.snowflake.com/profile/richardhou888/wallet
Popular Posts Recommended
-
Naming Convention in Python (代码规范,命名规则) General rules: CamelCase/camelCase (mixed case) CamelCase camelCase Ref: https://en.wikipedia.or...
-
SnowPro Badges and Certificates Online Verification https://achieve.snowflake.com/profile/richardhou888/wallet
-
End of Line Matters for Shell Script in CICD Pipeline You may get an error or failed pipeline if the end of line of a shell script file is C...
-
Write an SQL to check fraud transactions Certainly! Detecting and preventing fraud using SQL can be a powerful approach. Below, I’ll guide ...
-
Useful shortcuts for Notepad++ Indent one/multiple lines Tab Un-indent one/multiple lines Shift + Tab Select a column to edit/delete Ctrl + ...
-
rm command in Linux with examples (some are absolutely dangerous) rm command in UNIX stands for remove and by default is used for removing...