Questions tagged [sql-execution-plan]

A execution, or query plan, is the breakdown of steps the database engine uses to get a result.

A execution, or query plan, is the breakdown of steps the database engine uses to get a result. Specifically it is the plan that the optimizer determines is the best, most efficient, way to get the data.

The execution plan can be analyzed to determine what is happening and how to improve efficiency. Including finding if an index is being scanned or missing an index altogether. There is also many points of analytic data that can be acquired via the plan including things such as estimated and actual number of rows.

1429 questions
-1
votes
1 answer

Get list of columns, tables in query from 'show execution plan xml'

I need to get a list columns used in select statment, join, where and order by in query from 'show execution plan xml' in SQL Server into a table. Eg query: Select a.id, a.name, a.gender, a.marks, b.address From #temp a Inner join #temp1 b On…
Userabc
  • 11
  • 2
-1
votes
2 answers

How can i find the execution plan Hash value used by query in Oracle?

How can I find the execution plan Hash value used by query in Oracle. I have one query which is behaving very weirdly as some times it runs in 5 sec and sometimes it is taking more than 2 hours. I have checked with DBA and he told that there are…
-1
votes
2 answers

Table valued parameters join performance

I want to pass a list of names to a stored procedure and then perform a left join. I have passed the list of names as a table-valued parameter. CREATE PROCEDURE [DBO].[INSERTANDGETLATESTNAMES] (@list [dbo].[NamesCollection] READONLY) AS BEGIN …
-1
votes
1 answer

Why Index-seek is the most costly operator and not the Filter in this plan?

I have this plan that took ~ 18 seconds to run (generated by SentryOne plan explorer): The Index-seek used a non-clustered index, with some seek predicates. While the Filter operator has some other predicates including the LIKE condition. This is…
Hp93
  • 1,349
  • 3
  • 14
  • 23
-1
votes
2 answers

Same execution time for different time based where condition in SQL? How do I solve it?

My DB has 7M records with 30+ variables, the below query is to filter data based on daily basis which takes me around approximately 12 mins to return the results select customername, productname from xyztable where (datatime between '2019-05-17…
-1
votes
1 answer

Performance Tuning Advice

The execution plan is mentioned below. The SQL with this execution plan is running for over 16 minutes. SQL Server keeps on changing warning about what Indexes shall be built. Please advice. https://www.brentozar.com/pastetheplan/?id=BkyR0DIVU
-1
votes
1 answer

SQL query is taking more time than usual

My query is taking 2 hours to get 2.5 million rows from the database. I have checked the execution plan also. Indexing is also working fine. This is the query: SELECT GeneralJournalAccountEntry.RecId as [Transaction #], …
-1
votes
1 answer

Improve performance of same partition by clause

I have a table with 20+ columns, 45 millions rows. I am looking to summarize information for each Id with partition by, so that the numner of rows stay the same and information remains for each row select min(Distance) over(partition by Id) as…
-1
votes
1 answer

Postgresql different queries Why the same explain?

Query 1: select c_bh,c_xzdm,c_twhbm,d_tjrq from ( select c_bh,c_xzdm,c_twhbm,d_tjrq from t_table order by d_tjrq desc ) t1 limit 10 Query 2: select c_bh,c_xzdm,c_twhbm,d_tjrq from t_table order by d_tjrq desc limit 10 The same…
dodo
  • 11
  • 6
-1
votes
1 answer

Different query plan to the same query !

Possible Duplicate: how that happen SP sql server hello, I get something weird. i ran this sql: SELECT Id , GameTypeId , PlayerId , BetAmount , Profit , DateAndTime FROM Results WHERE DateAndTime >= DATEADD (DAY , -1…
dani
  • 17
  • 2
-1
votes
2 answers

why this is an index scan and not an index seek

A clustered index has been created on both dw_assesment_details and dw_assesment_details_id tables /* 6 minutes */ CREATE CLUSTERED INDEX [Ix_DW_ASSESSMENT_DETAILS_qid_QNO_TmpverName] ON [dbo].[DW_ASSESSMENT_DETAILS_QUESTION_ID] ( …
-1
votes
2 answers

Fast query on SQL Server but slower from PHP

We decided to migrate a MS SQL Server 2014 a DB into a different server that runs 2016. Now the PHP application that uses this DB has slowed down its performance significantly (queries have jumped from 1 or 2 seconds to 20), although the DB is…
-1
votes
2 answers

Sequence of query execution

When there is a correlated query, what is the sequence of execution? Ex: select p.productNo, ( select count(distinct concat(bom.detailpart,bom.groupname)) from dl_MBOM bom where bom.DetailPart=p.ProductNo ) cnt1 from dm_product…
Kaushik
  • 83
  • 5
-1
votes
1 answer

receiving ORA 00907 while trying to load optimized SQL execution Plan into plan table

I am receiving error when loading SQL Plan into plan table. Can anyone help me? Here are my codes : APPS@PROD1> @xplan.sql ((t2.productgroup_id = 15520) AND (t1.productgroup_id = 15520) /* * ERROR at line…
Lily
  • 35
  • 1
  • 1
  • 6
-1
votes
1 answer

MySQL trouble with table definition creating fulltable scan

I can't understand the following explains: The first one regards just PAZIENTE and ANALISI, it is ok, it is using index IDX_NOME explain select paziente3_.cognome as col_8_0_ from Analisi analisi0_ inner join Paziente paziente3_ on…
Etantonio
  • 359
  • 1
  • 5
  • 13