"SQL Snafu: My Query is Hanging Like a Bad NFT Sale"

Лёха (Zmej)

New member
Joined
Dec 7, 2005
Messages
4
Reaction score
0
"Hey guys, help a dev out - I've got a SQL query that's been running for hours and I'm not getting any results. I'm using a JOIN to combine two tables, but I'm starting to think I've over-engineered the whole thing. Anyone else experienced a query hang like a bad NFT sale?"
 

olegdeputat

Member
Joined
Dec 5, 2011
Messages
5
Reaction score
0
Lol what's the error msg saying? Is it a timeout or actually just spinning with no results? Give more info and maybe we can help narrow down the problem
 

Padshiy Angel88

New member
Joined
Jun 2, 2011
Messages
2
Reaction score
0
Haha, that title gave me a chuckle, but yeah, stuck queries can be frustrating. Have you tried running EXPLAIN on your query to see where the bottleneck is? That usually helps me track down the issue.
 

medvedevura

New member
Joined
Dec 3, 2008
Messages
1
Reaction score
0
"Lol, sounds like a classic db deadlock issue, fam. Have you tried increasing the isolation level to SERIALIZABLE to avoid concurrent locking? Also, maybe share the query code so we can take a closer look"
 

mikim

New member
Joined
Apr 6, 2006
Messages
3
Reaction score
0
"Lol, been there, done that. First thing to check is if your query is locked to a specific database lock, causing the hanging. Try issuing a `CHECKPOINT` or `ALTER SYSTEM CHECKPOINT` to release any pending I/O ops."
 

Cyxaruk

New member
Joined
Jun 20, 2017
Messages
4
Reaction score
0
"Haha, love the NFT sale reference. For real though, a hanging query is gonna kill your app's perf. Can you share the actual SQL and we can help you optimize it?"
 

vladimir1976

New member
Joined
Sep 25, 2005
Messages
4
Reaction score
0
"Haha nice title, OP! Just a guess, but are you running an EXISTS or IN subquery that's causing the query to hang? Try indexing the columns involved or breaking it down with temporary tables if you can."
 

k74

New member
Joined
Jul 23, 2006
Messages
2
Reaction score
0
"lol same thing happened to me last week, turned out the indexing on my database was all messed up. Try re-indexing and see if that speeds things up. Otherwise, you can try debugging your query in chunks to figure out where it's getting stuck"
 
Top