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 88 forks source link

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

Closed Deepesh125 closed 2 weeks ago

Deepesh125 commented 3 weeks ago

Description

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

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 3 weeks ago

Pull Request Test Coverage Report for Build 9482073087

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/iterative_exec.c 37 41 90.24%
<!-- Total: 39 43 90.7% -->
Files with Coverage Reduction New Missed Lines %
contrib/babelfishpg_tds/src/backend/tds/tds_srv.c 1 89.15%
contrib/babelfishpg_tsql/src/collationproperty.c 1 92.86%
contrib/babelfishpg_tds/src/backend/tds/tdscomm.c 1 73.97%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c 2 0.0%
contrib/babelfishpg_tds/src/backend/tds/err_handler.c 2 73.79%
contrib/babelfishpg_tsql/src/tsqlIface.hpp 3 84.21%
contrib/babelfishpg_tds/src/backend/tds/tdsprotocol.c 3 64.46%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c 4 0.0%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c 4 0.0%
contrib/babelfishpg_tds/src/backend/utils/adt/xml.c 4 30.85%
<!-- Total: 21623 -->
Totals Coverage Status
Change from base Build 9416708039: -37.2%
Covered Lines: 20739
Relevant Lines: 57909

πŸ’› - Coveralls
coveralls commented 3 weeks ago

Pull Request Test Coverage Report for Build 9487174116

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/pl_explain.c 0 1 0.0%
contrib/babelfishpg_tsql/src/iterative_exec.c 39 41 95.12%
<!-- Total: 41 44 93.18% -->
Totals Coverage Status
Change from base Build 9485967080: 0.02%
Covered Lines: 42312
Relevant Lines: 57910

πŸ’› - Coveralls
coveralls commented 3 weeks ago

Pull Request Test Coverage Report for Build 9488231564

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/pl_explain.c 0 1 0.0%
contrib/babelfishpg_tsql/src/iterative_exec.c 39 41 95.12%
<!-- Total: 41 44 93.18% -->
Totals Coverage Status
Change from base Build 9485967080: 0.02%
Covered Lines: 42312
Relevant Lines: 57910

πŸ’› - Coveralls
forestkeeper commented 3 weeks ago

I think we should not show antlr parsing time when we're using options like : BABELFISH_SHOWPLAN_ALL , we should show antlr parsing time when we're using options like : BABELFISH_STATISTICS PROFILE on, since output the antlr time costing is the purpose for explain analyze ( run the query , output the execution details )

coveralls commented 2 weeks ago

Pull Request Test Coverage Report for Build 9567662510

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 9554254032: 0.02%
Covered Lines: 42353
Relevant Lines: 57950

πŸ’› - Coveralls