Procedurally transform subquery into join

前端 未结 7 1456
有刺的猬
有刺的猬 2020-12-05 14:34

Is there a generalized procedure or algorithm for transforming a SQL subquery into a join, or vice versa? That is, is there a set of typographic operations that can be appli

相关标签:
7条回答
  • 2020-12-05 15:25

    A fully automatic system for transforming queries from sub-queries into joins would be relatively difficulty to build. You would need to take an input query, parse it into a parse tree and then perform some fairly complex pattern matches on the parse tree - replacing sections of the tree with new sections of the parse tree. At the end you do a traversal of the tree to output the new query.

    There can be some amazingly good or bad performance repercussions. Sometimes a sub-query is much faster than a join. Sometimes it is the inverse.

    0 讨论(0)
提交回复
热议问题