[FEATURE REQUEST] Pull TVP name from SQLServerDataTable to avoid execution of sp_sproc_columns_100
See original GitHub issueIs your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it
We use a lot of TVPs via PreparedStatement.setObject()
. Often times, we’re able to do this by passing in a SQLServerDataTable
instance but rarely are we ever able to use SQLServerPreparedStatement.setStructured()
. This causes SQLServerPreparedStatement to forcibly report the tvpName as null and then execute a query to load the tvpName (sp_sproc_columns_100 for modern SQL Servers). The execution of that query happens ends up executing about 1.4 million times per hour and causes a high CPU as a result.
Describe the preferred solution
In situations were we can still infer the tvpName
without using setStructured()
, such as when a SQLServerDataTable
is passed in, use the provided tvpName
.
Describe alternatives you’ve considered
We could alternatively use SQLServerPreparedStatement.setStructured()
. That requires calling unwrap()
on the PreparedStatement we have which breaks a metrics utility we use. Additionally, the problem is further complicated by frameworks like JdbcTemplate and Apache QueryRunner which may not provide access to the underlying SQLServerPreparedStatement
but still accept SQLServerDataTable
instances.
Additional context
This information was gained by querying sys.dm_exec_query_stats in SQL Server 2014.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Hi @Logic-32 , We will try to include the change in the next preview release, which is scheduled for March 31st.
#1282 merged.