babelfish-for-postgresql / babelfish_extensions

Babelfish for PostgreSQL provides the capability for PostgreSQL to work with applications written for Microsoft SQL Server. Babelfish understands the SQL Server wire-protocol and T-SQL, the Microsoft SQL Server query and procedural language, so you don’t have to switch database drivers or rewrite all of your application queries.
https://babelfishpg.org/
Apache License 2.0
265 stars 87 forks source link

Add support to show ANTLR Batch parsing time along with other explain information #2673

Closed Deepesh125 closed 1 week ago

Deepesh125 commented 2 weeks ago

This commit adds support to show ANTLR parsing time with EXPLAIN info. With this change, query plan would look like following:

1> select 1 + 1
2> select 'abc' + 'def'
3> go

-----------
          2

(1 rows affected)
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Query Text: select 1 + 1
Result  (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)
Planning Time: 0.389 ms
Execution Time: 0.057 ms

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
abcdef

(1 rows affected)
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Query Text: select 'abc' + 'def'
Result  (cost=0.00..0.01 rows=1 width=32) (actual time=0.025..0.026 rows=1 loops=1)
Planning Time: 0.219 ms
Execution Time: 0.083 ms

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Babelfish T-SQL Batch Parsing Time: 103.177 ms

Cherry-pick of https://github.com/babelfish-for-postgresql/babelfish_extensions/pull/2647

Task: BABEL-3650 Signed-off-by: Dipesh Dhameliya dddhamel@amazon.com

Check List

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

coveralls commented 1 week ago

Pull Request Test Coverage Report for Build 9608171114

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/iterative_exec.c 39 41 95.12%
<!-- Total: 41 43 95.35% -->
Totals Coverage Status
Change from base Build 9568439596: 0.02%
Covered Lines: 42117
Relevant Lines: 57410

💛 - Coveralls