Pomelo.EntityFrameworkCore.MySql
sequential-uuids
Our great sponsors
Pomelo.EntityFrameworkCore.MySql | sequential-uuids | |
---|---|---|
5 | 7 | |
2,639 | 293 | |
0.8% | - | |
8.7 | 3.6 | |
8 days ago | 7 months ago | |
C# | C | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Pomelo.EntityFrameworkCore.MySql
-
Mysql and Entity
EntityFramework uses providers to translate Linq queries into real queries and connect to the datasource and convert the data into .net readable format. The MySQL provider for .NET is the official one but I think it has fallen on hard times and is not developed as much as before. You should probably look at Pomelo, which is a community library for .net core: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql
- Whats the different between these two? What should I be using if im on NET 6?
- Github repositories to study from
-
Question about C# and MySql
For MySQL and friends you'll need the Pomelo data provider from https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql . Turns out there's an example of using the MySQL provider about halfway down that shows how to, but it is missing the '-o Model' parameter that you'd use to get your database model into a folder called Model.
-
Timeflake: 128-bit, roughly-ordered, URL-safe UUIDs
This approach has become my preferred way of generating IDs for database rows. It is relatively space efficient and doesn't require a round trip to the database to generate an ID like auto increment does.
While working on a C# implementation for MySQL and we found that when the DB uses Little Endian Binary that the GUID must be reversed to store in order:
https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCo...
sequential-uuids
-
Choosing a Postgres Primary Key
Disclaimer: not a dba so my terms might not be appropriate
I’ve seen uuid4 which replaces the first 4 bytes with a timestamp. It was mentioned to me that this strategy allows postgres to write at the end of the index instead of arbitrarily on disk. I also presume it means it has some decent sorting.
[inspiration](https://github.com/tvondra/sequential-uuids/blob/master/sequ...)
-
Install extensions from PGDG repo to YugabyteDB - example with sequential_uuids
yum install -y git git clone https://github.com/tvondra/sequential-uuids.git ysqlsh -h $(hostname) --echo-all --quiet \ --file sequential-uuids/test/sql/uuids.sql | sdiff sequential-uuids/test/expected/uuids.out -
-
Using a custom GUID (not provided by Postgres). What to keep in mind for performance gains
If you want to keep locality when using uuids, use a different generation function such as: https://github.com/tvondra/sequential-uuids
-
Any significant performance disadvantage to using uuid as primary key?
OP, have a pretty large B2B SAAS app with all UUID pkeys, and the largest issues i'd say with UUID compared to bigint are: size, index bloat, WAL bloat, much slower GIST indexes (for exclusion constraints). You can work around some of the issues (WAL bloat, index bloat) by using a better behaved UUID generation function: https://github.com/tvondra/sequential-uuids You can get something similar for your app side of things if you need to generate UUIDs there.
-
Timeflake: 128-bit, roughly-ordered, URL-safe UUIDs
Use this: https://github.com/tvondra/sequential-uuids
If you cannot install extensions, I just wrote a PL/PGSQL implementation for the time-based generator I could share.
-
UUID vs int for primary key - Which is better (with auto increment), especially if you are scared you'll run out of ids?
Just fyi, UUID in Postgres is not 40 text chars, it's 16 bytes binary and has a canonical text representation. Also, you don't need to use UUIDv4, I am quite partial to: https://github.com/tvondra/sequential-uuids
What are some alternatives?
MySqlConnector - MySQL Connector for .NET
timeflake - Timeflake is a 128-bit, roughly-ordered, URL-safe UUID.
Entity Framework - EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
pg_tuid - generate_tuid function for postgres
Detached-Mapper - An ORM friendly mapper. Allows saving entire entity graphs. Heavily inspired in GraphDiff and AutoMapper.
id128 - 128-bit id generation in multiple formats
ASP.NET Core - ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
uulid.go - ULID-UUID compatibility library for generating and parsing ULIDs.
umbrella - ⛱ Broadly scoped ecosystem & mono-repository of 190 TypeScript projects (and 155 examples) for general purpose, functional, data driven development
pg_tle - Framework for building trusted language extensions for PostgreSQL