Comments (6)
GVCs work just fine in our library with no changes! I've committed an example model and test in #86
from pomelo.entityframeworkcore.mysql.
JSON_CONTAINS
in MySQL causes a full table scan. If the table is large, this query will be very slow. MySQL's recommended approach is to create "Generated Virtual Columns"
I don't know if we should expose JSON_CONTAINS
queries through LINQ. People may use them thinking that it's a good idea, when in reality once their table grows they will have very slow queries.
@kagamine what are your thoughts? Should we nix JSON_CONTAINS
for 1.1 and instead find a way to let people query Generated Virtual Columns?
from pomelo.entityframeworkcore.mysql.
Wow, interesting. It seems the GVC is better.
from pomelo.entityframeworkcore.mysql.
<rant>
I personally think a JSON column type is not a great idea since it has a huge potential for being misused by the developer.
Think about it, any table can be stored in the following table by serializing the object representing the columns in the data
column:
CREATE TABLE DataStore (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`data` JSON NULL
)
Now should we do this? Absolutely not! MySQL is not a document store and if the developer thinks they need something like this then a document database is what they need to look for!
I always suggest using the JSON column type as you would a TEXT column type that has CSVs in it OR as you would a BLOB! Never store data that you need to search through or select a subset of in it.
Sure the possibility of indexing JSON columns by extracting their values is good to have for interop and backwards compatibility reasons (e.g when you have some data in JSON format that you need to import and use) but otherwise I'd say skipping GVCs and going through the motions of defining a column for it would be a better idea since it will be faster and will not impose a read/write overhead (based on if the value is GENERATED or STORED).
Also note that GVCs are not an option in the most common use cases of these BLOB types like JSON anyways. Just like the one you have in the README file (the tags list).
from pomelo.entityframeworkcore.mysql.
@dnetguru the JSON
type is very useful. If for no other reason, the JSON is stored in an Optomized Format
I always suggest using the JSON column type as you would a TEXT column
That is a good suggestion. It should never be searched directly, as this will cause a full table scan.
skipping GVCs and going through the motions of defining a column for it would be a better idea since it will be faster and will not impose a read/write overhead
GVCs can be VIRTUAL or STORED.
VIRTUAL indexed columns will write to the index when created/updated, but will not write to storage. Since the JSON format is optimized, generating the value when a row is returned in a result set will be very fast. This also allows to cut down on storage space.
STORED indexed columns will write to the index and storage when created/updated. There's really no difference here - the data is just extracted to the secondary column on the DBMS instead of on the App Server. I'd go so far as to argue that the DBMS will do this faster because it's a highly optimized codepath.
from pomelo.entityframeworkcore.mysql.
Congratulations to all of the contributors who worked on 1.0.1 and all of the testers who opened issues against 1.0.1! It's a great step forward and provides a very powerful tool to the modern .NET stack. I'm looking forward to using this in my apps and continuing to improve the library in 1.1.0!
from pomelo.entityframeworkcore.mysql.
Related Issues (20)
- `BytesToDateTimeConverter` creation is incompatible with compiled model code generation
- Using `SELECT ... ORDER BY (SELECT 1)` can lead to the return of unexpected data using Oracle MySQL releases HOT 4
- Method Not Found - Metadata.IMutableEntityType.GetProperties() HOT 3
- Non-deterministic connection interruptions after upgrading from 6.0 to 8.0 HOT 11
- how to read DateTimeOffset in specific timezone? HOT 7
- ServerVersion.AutoDetect(connectionString) fails HOT 8
- in 8.0.1 Is Timestamp byte[] no longer supported? HOT 11
- Implement support for Oracle MySQL's `CAST(... AT TIME ZONE ...)`
- Change return type of all `EF.Functions.DateDiff` extension methods related to units of `SECOND` or smaller from `int` to `long` HOT 4
- Just a quick question: does it support JSON data type? HOT 1
- Re-Opening connection hangs after successful query within scope of Http Request HOT 4
- Database generated value for DateTime givs an error after updating to version 8.0.1 HOT 5
- `Math.Log` number and base are in the wrong order in mysql `LOG` function HOT 1
- SEVERE ASP Api Response Time Problems with 8.0.1 and beyond HOT 10
- why string contains can be translated to like '' HOT 2
- Replace JSON_EXTRACT utilisation with JSON_VALUE HOT 5
- All primary keys altered in migration after upgrading efcore to 8.0.1 HOT 3
- Getting different SQL output for the same LINQ Query since upgrading to .NET 8 HOT 2
- ArgumentException: Option 'name' not supported. HOT 11
- Input string was not in a correct format when compare with TimeSpan HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pomelo.entityframeworkcore.mysql.