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
0
votes
0 answers

How to make this cypher faster?

This is the cypher: START n=node:ACCOUNTS(ACCOUNT_ID={id}) MATCH (n)-[:PROVIDER]->(p)<-[r:ALERT]-() RETURN r ORDER BY {o} ASC SKIP {s} LIMIT {l} Following is the execution plan: ColumnFilter(symKeys=[" UNNAMEDS239765216", "n", "m", " …
Debajyoti Roy
  • 985
  • 2
  • 12
  • 34
0
votes
1 answer

Parameterized SQL - in / not in with fixed numbers of parameters, for query plan cache optimization?

If SQL is used directly or created by NHibernate, with possibly big "where in / not in ([1 to 100 parameters])" conditions, does it make sense to fill up parameters to certain limits, to have a limited number of query plans? Parameters are…
Erik Hart
  • 1,114
  • 1
  • 13
  • 28
0
votes
1 answer

Total runtime of two counting methods

I wonder why total runtime of count(*) is smaller than count(primary_key) of the same table? Query plan (using explain analyze) shows that every time Postgresql is doing Seq Scan instead of using indexes? Why is that happening? and why indexes…
Borys
  • 2,676
  • 2
  • 24
  • 37
0
votes
1 answer

Postgresql Explain analyse : time between nodes

in a PostgreSQL explain plan like this one : http://explain.depesz.com/s/wwO What can justifie the time between the last hashjoin and hashaggregate ? Only the volume of data to manipulate ?
Sid
  • 331
  • 2
  • 10
0
votes
1 answer

MySql query plan chooses index with fewer rows to check but execution is much slower

I have a simple query - it only looks at one table and has a choice of 2 columns for indexing, an ErrorTypeId (points to a lookup table of about 20 unique values) and DateOccurred (a datetime column that could have any date in it). In most cases…
PeteGO
  • 5,597
  • 3
  • 39
  • 70
0
votes
2 answers

SQL Server Query - ORDER BY killing query performance on small result set

I have a query in SQL Server 2008 R2 in the following form: SELECT TOP (2147483647) * FROM ( SELECT * FROM sub_query_a ) hierarchy LEFT JOIN ( SELECT * FROM sub_query_b ) expenditure ON hierarchy.x = expenditure.x AND hierarchy.y =…
pcronin
  • 1,043
  • 1
  • 12
  • 17
0
votes
0 answers

Get told "the TDS protocol stream is not valid" when SET SHOWPLAN_TEXT ON

I have a slow query that I'm trying to analyze. MSDN says I can use SET SHOWPLAN_TEXT ON to get SQL Server to return the execution plan information for my query in text. However, whenever I try to SET SHOWPLAN and then execute my query, I get the…
Greg Dougherty
  • 3,281
  • 8
  • 35
  • 58
0
votes
1 answer

How SQL actually run in Memory? Row by Row

How does SQL actually run? For example, if I want to find a row with row_id=123, will SQL query search row by row from the top of memory?
0
votes
1 answer

SQL Server sp_recompile on a table

When sp_recompile is run against a table, I understand that all stored procedures and triggers dependent on that table will be recompiled. What I don't understand is what parameters SQL Server uses for this recompile. I can't see how parameter…
PseudoToad
  • 1,504
  • 1
  • 16
  • 34
0
votes
1 answer

Oracle execution plan cost vs speed

When building and tuning a query in Oracle, speed is generally the main concern for the developer. However, in tuning a particular query, I recently tried the FIRST_ROWS and NO_CPU_COSTING hints and an execution plan was generated that is 80% faster…
monitorjbl
  • 4,280
  • 3
  • 36
  • 45
0
votes
3 answers

Is there an application for displaying some kind of query plan for a Linq to object query?

I'm looking for an application to display what a linq expression would do, in particular regarding the usage of multiple access to the same list in a query. Better yet, the tool would tell if the linq query is good.
Stécy
  • 11,951
  • 16
  • 64
  • 89
0
votes
1 answer

Is there any way/platform on which SQL binds can be evaluated as-needed, during query execution?

Context: Say I have a large query (pseudo): SELECT %boundthing,data WHERE data in ( ...do lots of long-running stuff ) Let's assume boundthing isn't being used in my query anywhere but when I want to print the output (I know it's a stupid use…
Zac B
  • 3,796
  • 3
  • 35
  • 52
0
votes
2 answers

Functions in SQL Server 2008

Does sql server cache the execution plan of functions?
Developer
  • 17,809
  • 26
  • 66
  • 92
0
votes
1 answer

EXPLAIN PLAN needs to long

I am trying to figure out why the query needs so long, so I can optimize it. I tried it with EXPLAIN: EXPLAIN SELECT * FROM ( SELECT p.*, ol. prod_id olpid FROM products p LEFT JOIN orderlines ol ON p. prod_id = ol. prod_id ) pol WHERE pol. olpid…
0
votes
4 answers

SQL Server: Compare Index Performance

How can I compare the performance of an Index on a table using the Query Analyzer? I would like to run the same query through the Estimated Execution Plan twice, once using the index and once without, and have a good comparison of the table…
willoller
  • 7,106
  • 1
  • 35
  • 63