-
Notifications
You must be signed in to change notification settings - Fork 314
Open
Labels
Up-for-Grabs 🙌Issues that are ready to be picked up for anyone interested. Please self-assign and remove the labelIssues that are ready to be picked up for anyone interested. Please self-assign and remove the label
Description
Is your feature request related to a problem? Please describe.
When our application is starting it loads a lot of data from DB and it causes memory consumption growth and high pressure to GC because of big memory traffic.
On the third place of killed objects is boxed System.Data.SqlTypes.SqlGuid
struct.
These boxed values are 99.9% created when TdsParser
is putting SqlGuid
struct to SqlBuffer.SqlGuid
property (see the image bellow).
Describe the solution you'd like
SqlBuffer
already supports an efficient way to store Guid
values. What I would like to do is:
- change implementation of
Microsoft.Data.SqlClient.SqlBuffer
remove(taking the second alternative approach, removing ofSqlGuid
value fromStorageType
enumSqlGuid
value from enum looks like a bad idea);- save
Guid
representation ofSqlGuid
to_value._guid
(similar to whatGuid
setter does, but with checking ifSqlGuid
value is null) - read
SqlGuid
value from_value._guid
Describe alternatives you've considered
- add a field of
SqlGuid
type toSqlBuffer
, but it seems memory inefficient - same as the main approach, but without removing
SqlGuid
value fromStorageType
enum, in case it is really important. The only place where it looks important to me iss_dbTypeToStorageType
mapping array inMicrosoft.Data.SqlClient.Server.ValueUtilsSmi
, and I am not sure if it is safe to change the mapping toSqlBuffer.StorageType.Guid
. It seems like it is not safe, because implementation ofSqlBuffer.Guid
does not support nulls.
Additional context
- Microsoft.Data.SqlClient version is 5.1.0;
- We use Microsoft.Data.SqlClient together with NHibernate;
- Almost all our db tables contain Guid columns, so, memory traffic is really high in our case.
Metadata
Metadata
Assignees
Labels
Up-for-Grabs 🙌Issues that are ready to be picked up for anyone interested. Please self-assign and remove the labelIssues that are ready to be picked up for anyone interested. Please self-assign and remove the label
Type
Projects
Status
Under Investigation