sql-execution-plan

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

柔情痞子 提交于 2019-12-31 10:32:11
问题 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

Postgres: Why is the performance so bad on subselects with Offset/Limit

纵然是瞬间 提交于 2019-12-31 01:29:25
问题 Can you please help me understand the reason for the performance drop between these statements? For me it seems like in case of D & E he is first joining the address to all subscribers and at the end applies Offset & Limit. Why on earth would he do that? Am I missing something about how Subselects and Offset work together? Shouldn't he first find the right offset and then start executing the subselects? user_id and address_id are primary keys Select A: 15 ms (OK) : select first 200

Postgres: Why is the performance so bad on subselects with Offset/Limit

て烟熏妆下的殇ゞ 提交于 2019-12-31 01:29:04
问题 Can you please help me understand the reason for the performance drop between these statements? For me it seems like in case of D & E he is first joining the address to all subscribers and at the end applies Offset & Limit. Why on earth would he do that? Am I missing something about how Subselects and Offset work together? Shouldn't he first find the right offset and then start executing the subselects? user_id and address_id are primary keys Select A: 15 ms (OK) : select first 200

Oracle execution plans when using the LIKE operator with a DETERMINISTIC function

梦想的初衷 提交于 2019-12-30 11:32:22
问题 Now I have a really tricky thing with Oracle execution plans running havoc, when I use a DETERMINISTIC function on the right hand side of the LIKE operator. This is my situation: The Situation I thought it to be wise to execute a query like this (simplified): SELECT [...] FROM customers cust JOIN addresses addr ON addr.cust_id = cust.id WHERE special_char_filter(cust.surname) like special_char_filter(?) And I would bind ? to something like 'Eder%' . Now customers and addresses are very large

SQL explain plan: what is Materialize?

感情迁移 提交于 2019-12-30 00:13: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. 回答1: 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

sql using different execution plans when running a query and when running that query inside a stored procedure?

China☆狼群 提交于 2019-12-24 18:21:50
问题 I have this query, Declare @Prcocessrate float declare @item varchar(20) declare @process varchar(20) declare @branch varchar(20) set @item = 'shirt' set @process = 'kt' set @branch = '1' select @Prcocessrate = ProcessPrice from itemwiseprocessrate where itemname=@Item and Process=@process and branchid=@branch when I run it single handed, the execution plan only shows 3 steps , see for youself.. but I have this procedure sp_newBooking as ALTER PROC sp_newbooking -- other arguements-- AS BEGIN

Why does Max() create an order by in the explain plan?

萝らか妹 提交于 2019-12-24 16:15:08
问题 When I attempt to do something like SELECT Max(ObjectId) FROM Objects; I see that in the explain-plan that this is performed by doing a sort. Now, sorting (which I guess would require something in the complexity of O(nlogn) ) must be much costlier than just scanning each row and remembering the max value (which could be done in O(n) ). Am I missing something here? Is oracle really performing a sort or does the explain-plan just use the description "sort" for describing a simple scan of all

SQL Server 2005 cached an execution plan that could never work

为君一笑 提交于 2019-12-24 09:58:38
问题 We have a view that is used to lookup a record in a table by clustered index. The view also has a couple of subqueries in the select statement that lookup data in two large tables, also by clustered index. To hugely simplify it would be something like this: SELECT a, (SELECT b FROM tableB where tableB.a=tableA.a) as b (SELECT c FROM tableC where tableC.a=tableA.a) as c FROM tableA Most lookups to [tableB] correctly use a non-clustered index on [tableB] and work very efficiently. However, very

How to force accept a SQL Plan Baseline?

折月煮酒 提交于 2019-12-24 07:23:07
问题 In Oracle (looking at this in Oracle Enterprise Manager) I have a particular SQL Plan Baseline which is set to Enabled = YES. However, I can't get the ACCEPTED = YES to work. According to the documentation, you need ENABLED and ACCEPTED both. I tried to "evolve" the Baseline but OEM complains (via a Report) that it's 1.06 times worse. That's not true though. Also I would like to know how to ensure it does not auto-purge over time and that's it's fixed. Thanks! 回答1: To enable baseline usage,

MySQL not picking correct row count from index

寵の児 提交于 2019-12-24 07:09:07
问题 I have a following table CREATE TABLE `test_series_analysis_data` ( `email` varchar(255) NOT NULL, `mappingId` int(11) NOT NULL, `packageId` varchar(255) NOT NULL, `sectionName` varchar(255) NOT NULL, `createdAt` datetime(3) DEFAULT NULL, `marksObtained` float NOT NULL, `updatedAt` datetime DEFAULT NULL, `testMetaData` longtext, PRIMARY KEY (`email`,`mappingId`,`packageId`,`sectionName`), KEY `rank_index` (`mappingId`,`packageId`,`sectionName`,`marksObtained`), KEY `mapping_package` (