programmer group

SQL statement to query index usage

SELECT sch.name + '.' + t.name AS [Table Name], i.name AS[Index Name], i.type_desc, ISNULL(user_updates,0) AS [Total Writes], ISNULL(user_seeks +user_scans + user_lookups,0) AS [Total Reads], s.last_user_seek, s.last_user_scan , s.last_user_lookup, ISNULL(user_updates,0) - ISNULL((user_seeks+ user_scans +user_lookups),0)AS [Difference], p.reserved_page_count * 8.0 / 1024 as SpaceInMB FROM sys.indexes...

programmer group

Example of using query generator query() in yii2 framework

This article describes the use of query generator query () in yii2 framework. The details are as follows: Yii / db / query in yii2 provides us with rich methods to build complex SQL statements. The biggest difference between query () and create command is that the latter directly uses the SQL statements we have written. The former generates different SQL through parameters and database types, so it has better...

cybertec-postgresql.com cybertec-postgresql.com

How the PostgreSQL query optimizer works

Just like any advanced relational database, PostgreSQL uses a cost-based query optimizer that tries to turn your SQL queries into something efficient that executes in as little time as possible. For many people, the workings of the optimizer itself remain a mystery, so we have decided to give users some insight into what is really going on behind the scenes. So let’s take a tour through the PostgreSQL optimizer and get an overview of...