Skip to main content

Subquery behavior and lock trivia

  • June 22, 2018
  • 1 reply
  • 3 views

Bryan_H
Forum|alt.badge.img+2

Hi, two part question: is it possible to look up historical lock request info? We want to look at lock states before a crash, after the fact. This is for 7.2.x and I am not sure whether this would be in DC tables or elsewhere.

Second part: we have a JOIN query between a table and a subquery. All tables referenced have correct projections for the JOIN. However, do we lose the projection info when using a subquery? The explain improved 20X just by flattening the subquery. I don't have the exact query but it is in the general form
SELECT a.x, b.y FROM a JOIN (SELECT b.y FROM bSrc WHERE bSrc.z in {SET}) ON a.x=b.y
and the projections for a and bSrc are ordered by the join fields.
My suspicion is that the "b" subquery looks like an unoptimized temp table and that is the cause for the slowdown - is that on the right track?

1 reply

Car1os
Forum|alt.badge.img
  • Participating Frequently
  • June 22, 2018

dc_lock_attempts has the lock information and if it was granted or not, you can also check the system view lock_usage but I don't think that one has the detail if the lock was granted or not.

Regarding the subquery, it's odd, check the plan, if the subquery is being turned into a temp table then that could be the problem, but I don't think we do that by default.