-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json: add ability to specify type of the json column #28452
Comments
@ajcvickers @maumar |
We hope to include it in EF8, but that will depend on prioritization against other features. Make sure to vote (👍) for this issue. |
Sorry for reopen but does this mean that i cant change nvarchar(max) for json columns?. Cause that is exactly what i am trying to do according to Microsoft documentation to use nvarchar(4000) for performance reasons. |
@cdrfenix can you share some more context? Are you trying to store JSON documents in an nvarchar(4000) column (instead of max)? If so, why? Is it so that you can index the entire JSON document, and if so, how would you be using that index? @shvmgpt116 some more information on why you need this would be appreciated. |
No i wont index it, i am just trying to follow ms recommendation according to the documentation in here: https://learn.microsoft.com/en-us/sql/relational-databases/json/store-json-documents-in-sql-tables?view=sql-server-ver16 Even tho they tell you twice to use nvarchar(4000) "for performance reasons" it doesnt explain in detail why. So if the reason its only for using a index then i guess i dont have a problem and nvarchar(max) will just do it. Also this article could be relevant in relation to this issue (but not my use case): https://bornsql.ca/blog/think-twice-about-storing-json-in-your-sql-server-database/ |
Thanks for the links. I'm not enough of a SQL Server expert to know exactly how nvarchar(4000) vs. nvarchar(max) affect performance, but this comment does seem to point to that being important:
Note that compression (and possibly even columnstore) is a bit orthogonal to this; but also important. |
Another need here is using varchar instead of nvarchar on SQL Server, especially for UTF8 (raised in #33643). |
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
Fixes #28452 Fixes #32150 Remaining work: - Test reverse engineering from an existing database - Output a warning when the native JSON type is used - Replace the ToJson overload with HasColumnType() - Move the type mapping visitation to another visitor Known issues: - Various issues communicated with the SQL team--see TODO:SQLJSON - Testing is disabled until we have an appropriate server and driver to test against
E.g. in postgres there are 2 types for json column: json and jsonb. We should allow specifying the type explicitly for each aggregate, once we land on final API
The text was updated successfully, but these errors were encountered: