question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE REQUEST] Pull TVP name from SQLServerDataTable to avoid execution of sp_sproc_columns_100

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ulviicommented, Mar 20, 2020

Hi @Logic-32 , We will try to include the change in the next preview release, which is scheduled for March 31st.

0reactions
ulviicommented, Mar 27, 2020

#1282 merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found