felipebz / zpa

Parser and static code analysis tool for PL/SQL and Oracle SQL.
https://zpa.felipebz.com
GNU Lesser General Public License v3.0
211 stars 77 forks source link

Slow query parsing #183

Closed felipebz closed 2 months ago

felipebz commented 2 months ago

While using the test files from antlr/grammars-v4, I've noticed a delay in this particular query: https://github.com/felipebz/grammars-v4/blob/086ca965a5fcff502e338879e50a0013b072683d/sql/plsql/long-running/cast_multiset07.sql

On my computer, it takes approximately 35 seconds to parse. This issue is also replicable with the following shorter version:

select *
  from tab
 where col = any(((
         select * from the (select * from dual)
       )))
felipebz commented 2 months ago

The same query now takes 7ms on my PC.