PostgreSQL CTEs và Window Functions: Kỹ thuật truy vấn nâng cao. Tìm hiểu cách sử dụng CTEs (Common Table Expressions) và Window Functions trong PostgreSQL để viết các truy vấn phức tạp và hiệu quả hơn.

#PostgreSQL #Database #SQL #CTEs #WindowFunctions #LậpTrình #CơSởDữLiệu

https://www.reddit.com/r/programming/comments/1m4jprb/postgresql_ctes_window_functions_advanced_query/

📚🤔 Oh, you thought you could outsmart #PostgreSQL with your pseudo-intellectual use of #CTEs, LIMIT, and RETURNING? 😂 Surprise! The query planner's got a PhD in confusion, and you're still stuck in #SQL 101. Better luck next time, code wizard. 🧙‍♂️🔮
https://www.shayon.dev/post/2025/119/a-postgresql-planner-gotcha-with-ctes-delete-and-limit/ #humor #coding #wisdom #HackerNews #ngated
A PostgreSQL planner gotcha with CTEs DELETE and LIMIT

How a seemingly straightforward DELETE query using a CTE and LIMIT returned more rows than expected due to query planner optimization.

Shayon Mukherjee
Db2 SQL Window Function Errors in CTEs: Troubleshooting and Solutions
Db2 SQL Window Function errors in CTEs? Learn how to troubleshoot common issues with column referencing, correlation between CTEs & subqueries, and avoid "SQL0206N" errors. Master proper use of aliases & joins for accurate results! #DB2 #SQL #WindowFunctions #CTEs #Database #Programming
https://tech-champion.com/database/db2luw/db2-sql-window-function-errors-in-ctes-troubleshooting-and-solutions/
Learn to Optimize SQL Queries for faster, cleaner code! This post shows how combining multiple SELECT statements into a single, well-structured query improves efficiency using CTEs & other methods. #SQLoptimization #SQLqueries #Databaseoptimization #CTEs #queryperformance #efficientSQL https://tech-champion.com/database/optimize-sql-queries-combining-multiple-select-queries-for-efficiency
Tuple shuffling: Postgres CTEs for Moving and Deleting Table Data | Crunchy Data Blog

David has some tricks and sample code for using CTEs to manipulate data and move things around inside your database. This can be especially handy for sorting, moving, or labeling data and moving it to an archive.

Crunchy Data

@jago @janrosenow
The #PitThermalEnergyStorage PTES solution used in Denmark appears significantly cheaper than #CavernThermalEnergyStorage CTES which is popular in Finland.

The 200.000m³ #PTES in Vojens costs about 30 €/m³ whereas #CTES #Varanto in Vantaa costs 200 €/m³.

However, PTES is not pressurised and thus limited to 95°C while #Varanto CTES reaches 140°C, increasing both storage capacity and value of heat.

https://solarthermalworld.org/news/seasonal-pit-heat-storage-cost-benchmark-30-eurm3/
https://solarheateurope.eu/2020/05/19/vojens-district-heating/
https://www.sciencedirect.com/topics/engineering/pit-thermal-energy-storage

Seasonal pit heat storage: Cost benchmark of 30 EUR/m³ | Solarthermalworld

Denmark has had a successful learning curve regarding to the cost and efficiency of seasonal pit heat storage, which is used to store sunlight in summer for heating purposes in […]

Solarthermalworld