sql-execution-plan

SQL explain plan: what is Materialize?

大城市里の小女人 提交于 2019-12-02 21:45:52
I asked PostgreSQL to explain my query. Part of the explanation was: table_name --> Materialize What does materialize do? I'm joining two tables, not views or anything like that. A materialize node means the output of whatever is below it in the tree (which can be a scan, or a full set of joins or something like that) is materalized into memory before the upper node is executed. This is usually done when the outer node needs a source that it can re-scan for some reason or other. So in your case, the planner is determining that the result of a scan on one of your tables will fit in memory, and

Tools for visualising execution xml plans as HTML

被刻印的时光 ゝ 提交于 2019-12-02 20:48:55
Are there any tools / XSLT style sheets around for transforming the XML execution plans returned by Microsoft Visual Studio into HTML? Failing that, does anyone know of any techniques that can be used to display charts in HTML suitable for displaying execution plans? I couldn't find one so I made one myself https://github.com/JustinPealing/html-query-plan Its currently being used on the Stack Exchange Data Explorer , Paste the Plan and Azure Data Studio. 来源: https://stackoverflow.com/questions/4800473/tools-for-visualising-execution-xml-plans-as-html

Missing STOPKEY per partition in Oracle plan for paging by local index

☆樱花仙子☆ 提交于 2019-12-02 20:29:29
There is next partitioned table: CREATE TABLE "ERMB_LOG_TEST_BF"."OUT_SMS"( "TRX_ID" NUMBER(19,0) NOT NULL ENABLE, "CREATE_TS" TIMESTAMP (3) DEFAULT systimestamp NOT NULL ENABLE, /* other fields... */ ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "ERMB_LOG_TEST_BF" PARTITION BY RANGE ("TRX_ID") INTERVAL (281474976710656) (PARTITION "SYS_P1358" VALUES LESS THAN (59109745109237760) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 8388608 NEXT 1048576

How to Clear down Query Execution Statistics in SQL Server 2005/2008

你说的曾经没有我的故事 提交于 2019-12-02 17:41:05
Based on getting Query Execution Statistics using this extremely useful piece of SQL obtained from this post Most Executed Stored Procedure - Stack Overflow : SELECT TOP 100 qt.TEXT AS 'SP Name', SUBSTRING(qt.text, qs.statement_start_offset/2, CASE WHEN (qs.statement_end_offset = -1) THEN LEN(qt.text) ELSE (qs.statement_end_offset - qs.statement_start_offset)/2 END) AS actual_query, qs.execution_count AS 'Execution Count', qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime', qs.total_worker_time AS 'TotalWorkerTime', qs.total_physical_reads AS 'PhysicalReads', qs.creation_time

What is the difference between Seq Scan and Bitmap heap scan in postgres?

本秂侑毒 提交于 2019-12-02 16:07:30
In output of explain command I found two terms 'Seq Scan' and 'Bitmap heap Scan'. Can somebody tell me what is the difference between these two types of scan? (I am using PostgreSql) http://www.postgresql.org/docs/8.2/static/using-explain.html Basically, a sequential scan is going to the actual rows, and start reading from row 1, and continue until the query is satisfied (this may not be the entire table, e.g., in the case of limit) Bitmap heap scan means that PostgreSQL has found a small subset of rows to fetch (e.g., from an index), and is going to fetch only those rows. This will of course

Execution plan cache for PL/pgSQL functions in PostgreSQL

自闭症网瘾萝莉.ら 提交于 2019-12-02 09:15:31
If I change PL/pgSQL function that is in use in another PL/pgSQL function will the PostgreSQL rebuild execution plan for both of them or only for changed one? Say I have 2 functions using third one. Say function check_permission(user_id) is used by get_company(user_id) and get_location(user_id) . And I they got cached their execution plan somehow. And then I change check_permission , would the execution plan caches for get_company(user_id) and get_location(user_id) be deleted and rebuilt on demand? PostgreSQL tracks dependencies, and it flushes caches pretty aggressively when things change. If

How to: Change actual execution method from “row” to “batch” - Azure SQL Server

*爱你&永不变心* 提交于 2019-12-02 07:40:32
问题 I am having some major issues. When inserting data into my database, I am using an INSTEAD OF INSERT trigger which performs a query. On my TEST database, this query takes much less than 1 second for insert of a single row. In production however, this query takes MUCH longer (> 30 seconds for 1 row). When comparing the Execution plans for both of them, there seems to be some CLEAR differences: Test has: "Actual Execution Method: Batch" Prod has: "Actual Execution Method: Row" Test has: "Actual

How to: Change actual execution method from “row” to “batch” - Azure SQL Server

*爱你&永不变心* 提交于 2019-12-02 03:50:21
I am having some major issues. When inserting data into my database, I am using an INSTEAD OF INSERT trigger which performs a query. On my TEST database, this query takes much less than 1 second for insert of a single row. In production however, this query takes MUCH longer (> 30 seconds for 1 row). When comparing the Execution plans for both of them, there seems to be some CLEAR differences: Test has: "Actual Execution Method: Batch" Prod has: "Actual Execution Method: Row" Test has: "Actual number of rows: 1" Prod has: "Actual number of rows 92.000.000" Less than a week ago production was

Can JDBC statement run execution plan / explain plan?

拥有回忆 提交于 2019-12-01 14:32:00
Can JDBC statement run explain plan on query string? The code throws SQL exception Error message: Incorrect syntax near the keyword 'plan'. Stacktrace is null I just copy from internet of using stmt.execute. However, it seems that stmt.execute() only Returns true if the first result is a ResultSet object; false if it is an update count or there are no results conn = getEntityManager().unwrap(java.sql.Connection.class); stmt = conn.createStatement(); stmt.execute("explain plan for SELECT 1 from Dual"); // throws sql exception rs = stmt.executeQuery("select plan_table_output from table(dbms

Can JDBC statement run execution plan / explain plan?

戏子无情 提交于 2019-12-01 13:02:35
问题 Can JDBC statement run explain plan on query string? The code throws SQL exception Error message: Incorrect syntax near the keyword 'plan'. Stacktrace is null I just copy from internet of using stmt.execute. However, it seems that stmt.execute() only Returns true if the first result is a ResultSet object; false if it is an update count or there are no results conn = getEntityManager().unwrap(java.sql.Connection.class); stmt = conn.createStatement(); stmt.execute("explain plan for SELECT 1