All Questions
11
questions
1
vote
2
answers
398
views
Nested loop inner join with index lookup and filter is slow
I have this query I'm running in MySQL:
SELECT
count(*)
FROM
library AS l
JOIN plays AS p ON p.user_id = l.user_id AND
l.path = p.path
WHERE
l.user_id = 20977 AND
p.time >= '...
1
vote
1
answer
303
views
SQL Server hash match when joining to view
I have a subquery, which always return 1500 rows, because of TOP 1500 on the beginning. It gets left joined to a view, which returns 15mil rows if called outside any context. And in execution plan I'm ...
0
votes
0
answers
56
views
Almost equal table with different running time
I’m using oracle. I have two table A and B
Table A has 8000 rows and 5 five columns
Table B has 5500 rows and same 5 columns
All of 5500 rows in table B are contained in Table A and they are the same
...
0
votes
1
answer
53
views
WHEN run query it take too much time although it return small number or records?
I work on SQL server 2012 I face issue when run query below it take 9 minutes to return 900 rows only
SELECT fmat.Value as PLID,c.CodeTypeId,
COUNT(DISTINCT tr.PartID) [#partsHasCodes]
into #...
1
vote
1
answer
4k
views
Merge join not working as documented Redshift
From AWS Documentation:
Merge Join
Typically the fastest join, a merge join is used for inner joins and outer joins. The merge join is not used for full joins. This operator is used when joining ...
2
votes
2
answers
154
views
Weird join on on behavior in tsql [duplicate]
I recently found old code that uses JOIN JOIN ON ON instead of the more familiar JOIN ON JOIN ON syntax.
DECLARE @a TABLE (
val INT
)
DECLARE @b TABLE (
val INT
)
DECLARE @c TABLE (
val ...
4
votes
3
answers
785
views
Oracle JOIN operation performance changes when swapping SELECT statements
I came across the following behavior while studying Oracle query parsing and performance. I used following query for that,
SELECT 1
FROM USER_PROCEDURES
WHERE OBJECT_NAME = SUBSTR( UPPER('...
-1
votes
1
answer
266
views
DB2 Plan table method
Which of the method value given in a plan table row is better when a join is involved in tables?
method=1, nested loop join
method=2, merge scan join
method=4, hybrid join
5
votes
3
answers
12k
views
Simple SQL to check if parent has any child rows or not
I show a grid with parent data and need to show icon if it has a relevant child row(s) exist. My DB is in SQL Server 2008. Let me simplify, I've the following two tables -
Order (PK : ID)
...
0
votes
1
answer
412
views
Why index is not used for Group by and/or Join when key exists on the column
I have this query:
SELECT p.prodno AS id,
proddesc AS label
FROM product p
JOIN sales s
ON s.custno = 00800
AND s.deptno = 0
AND s.prodno = p....
16
votes
7
answers
13k
views
SQL order of operations [duplicate]
If I run the following SQL query
SELECT *
FROM A
LEFT JOIN B
ON A.foo=B.foo
WHERE A.date = "Yesterday"
Does the WHERE statement get evaluated before or after the JOIN?
If after, what would be a ...