All Questions
Tagged with sql sql-execution-plan
126
questions with no upvoted or accepted answers
7
votes
1
answer
272
views
MySQL Optimiser - cost planner doesn't know when DuplicateWeedout Strategy creates disk table
This is my sample query
Select table1.id
from table1
where table.id in (select table2.id
from table2
where table2.id in (select table3.id
...
5
votes
0
answers
131
views
Why does DBD::SQLite have a different query plan for an SQL statement
I have an INSERT INTO... SELECT ... FROM SQL statement that runs acceptably fast when executed from SQLite's command line shell.
However, if I execute the same statement (copy/pasted) with Perl's DBI:...
4
votes
1
answer
449
views
How can sorting (before a merge join) increase the number of rows?
I'm working on a query that's performing terribly:
SELECT COUNT(*)
FROM ps
INNER JOIN p ON p.id = ps.patient_id
INNER JOIN hh ON hh.id = ps.hh_id
INNER JOIN cma ON cma.id = ps.cma_id
INNER JOIN ...
4
votes
1
answer
792
views
get existing SQL plan for Postgresql
I would like to view my old existing SQL plan at my PostgreSQL
I am aware Oracle have a view called DBA_HIST_SQL_PLAN
tried to google 'existing or old SQL plan PostgreSQL but could not find ...
4
votes
2
answers
4k
views
Oracle query slow when joining, fast when splitted into two queries
I have a sql query which is quite slow when joining two tables but is fast when I first query one table and with its output query the other table.
Environment/Preconditions
Oracle Version:
Oracle ...
3
votes
0
answers
562
views
Azure SQL delete performance is much slower than local SQL-Express Server
The problem
I am using "Windows Azure SQL Database" and have following behavior.
A delete statement (2000 rows) need some seconds on my local machine. On the azure sql database it needs over 2 ...
3
votes
1
answer
998
views
Why does nonclustered index column still do index scan instead of index seek
I have the following tables
EmployeePatientLink
Id nvarchar(128) PK & clustered index
PatientId nvarchar(128) FK NULL -- nonclustered index created
EmployeeId int NULL-- nonclustered index ...
3
votes
1
answer
182
views
Oracle plan for comparing 'b' vs. 'B' 998x as slow (10g or 11g)
Have a query to set records as bad by comparing with another table. To save time, I exclude records that have already been marked as 'bad'.
I wrote a query, but accidentally checked for != 'b' ...
2
votes
0
answers
108
views
Improve performance of SQL query
I have a slow performing query which I am at a loss on how I could make more efficient. SQL isn't my speciality, but currently this query is taking about 3 seconds on average to run. I've run an ...
2
votes
4
answers
2k
views
Slow Query Groupby, Join MYSQL laravel
I have 4 tables: places, brands, categories, locations.
The relationship are Places belongTo Brands and Places ManytoMany with Categories and Locations.
I want to get search results Places with ...
2
votes
0
answers
504
views
UPDATE FROM with JOIN over ctid leads to Seq Scan
To clarify my problem I have created a test table with the following structure.
CREATE TABLE public.test_large (
id int4 NOT NULL, -- Primary Key
grp int4 NULL, -- Group ID
descr text ...
2
votes
2
answers
6k
views
Cost of using OPTION (RECOMPILE) vs Joining to tables
Using: SQL Server 2016+
I've been looking to see if there is any way to evaluate how long it takes SQL Server to recompile the execution plan for a query. We have several stored procedures where we ...
2
votes
2
answers
226
views
Why does the query optimizer use sort after merge join?
Consider this query:
select
map,line,pda,item,qty,qty_gift,pricelist,price,linevalue,vat,
vat_value,disc_perc,disc_value,dt_disc_value,netvalue,imp_qty,
imp_value,exp_qty,exp_value,price1,...
2
votes
0
answers
2k
views
Explaining the Explain in teradata
Explain
sel * from sandbox.comapny_employees ce
left join
sandbox.comapny_age ca
on ce.age=ca.age and ce.age>42
some times its really confusing to understand how explain plan was ...
2
votes
0
answers
277
views
Why do execution times differ between SQL statistics and profiler?
I am using SQL Server Management Studio 2014. I have a query that is taking more time than I would like to return. I first noticed the issue while testing my API with postman. The request selects ...