All Questions
Tagged with sql sql-execution-plan
535
questions
1
vote
1
answer
81
views
SQLServer join order
From the SQLServer SELECT docs:
The following steps show the logical processing order, or binding order, for a SELECT statement. This order determines when the objects defined in one step are made ...
2
votes
1
answer
267
views
Understanding a SQL Server execution plan
I have the following query which I'm using to review the SQL Server execution plan.
SELECT TOP 1000
fact.division,
case when fact.division='east' then 'XXX' else 'YYY' end div,
count(1)
...
2
votes
1
answer
790
views
PostgreSQL EXPLAIN: How do I see a plan AS IF certain tables had millions of rows?
This is a question about PostgreSQL's EXPLAIN command. This command shows you how the optimizer will execute your SQL based on the data in your tables. We are not in prod yet, so all of our tables ...
0
votes
1
answer
356
views
Oracle filter by max date
I'am searching for the best way to filter a table by a MAX date.
Is it better to find with a select in the where
SELECT *
FROM
table1 foo
WHERE
foo.date_tmp =
(
...
0
votes
2
answers
167
views
Oracle DDL statment ( like CTAS) , after executed, not show in V$SQL
Why Oracle "DDL" statements (like "CTAS"), after executed, does not shown in V$SQL view ?
How can get "SQL_ID" of that? I want to use "SQL_ID" in SQl plan ...
1
vote
1
answer
79
views
Show estimate vs actual estimations in query plan
For some reason my plans dont show an actual vs estimation in the designer query plan. I have seen these show on Brent Ozar videos. How do I get those to show?
0
votes
1
answer
145
views
Stored procedure has different plans in different databases, can't replicate better plan in main database
Can you point me in the right direction on where to look to figure out why one plan cache is different from the other one in another database. One database is older and has less data but the schema ...
1
vote
2
answers
1k
views
Improving the query processing performance of SUM and JOIN SQL
SELECT SUM(C_QUANTITY)
FROM CARS JOIN ORDERS
ON C_ORDERKEY = O_ORDERKEY;
I have this query that aggregate sum of L_QUANTITY from the JOIN tables. The query cost, by using EXPLAIN PLAN is 12147. The ...
0
votes
0
answers
68
views
Can you increase the time SQL Server's Query Optimizer has to find the Best Query Plan?
"...the optimizer is not built to select the best execution plan, but instead to search and find the best possible plan after a set amount of time passes."
Hoping to find a way to override ...
0
votes
2
answers
2k
views
Postgres subqueries running extremely slow, Why?
I've found queries that are sometimes slow to respond and are looking at the execution (explain analyze) plan.
I think the joining part in the subquery is slow, but looking at the execution plan, I ...
0
votes
1
answer
156
views
High cost SQL shows low cost when testing with parameters in SQL Server
My activity monitor shows this high cost query being run below without the value for DivisionPoolId and a high cost to run. I test it out with a real DivisionPoolId and the cost is low. I am not ...
3
votes
2
answers
2k
views
Performance impact of view on aggregate function vs result set limiting
The problem
Using PostgreSQL 13, I ran into a performance issue selecting the highest id from a view that joins two tables, depending on the select statement I execute.
Here's a sample setup:
CREATE ...
0
votes
1
answer
99
views
When mysql updates a non-indexed column,why can use the primary key
MySQL version is 8.0.23
Create table and insert data
CREATE TABLE `test_update` (
`id` int NOT NULL ,
`column1` varchar(20) DEFAULT NULL,
`column2` varchar(20) DEFAULT NULL,
...
2
votes
2
answers
690
views
How do I obtain a Query Execution Plan in Oracle IDEs?
In Oracle IDEs, such as Navigator, Toad, Oracle SqlDeveloper how can I get a query execution plan for a query / stored procedure?
I can find some commands for them online, even though I am not able to ...
0
votes
0
answers
40
views
Regex join query optimization in PostgresSQL
How can I optimize this query below, it took 8 hrs to run :
create table rtime.rtime_calc1_jun13tojun19 as(
explain select pa.api as pa_api, pa.action_type as pa_action_type, max(rt.request_time), ...