Hi, @Florin. Welcome to Microsoft Q&A.
1.Entity Framework cannot dynamically create Model based on Table and map it to DbContext. You could consider using SQL query instead of Entity Framework to achieve dynamic mapping.
2.A single table is too large to be managed effectively. PostgreSQL partitioning is a good method at this time.
PostgreSQL partitioning advantages:
Performance improvement
The query will only scan the relevant partitions instead of the entire table, which significantly reduces I/O operations.
Partitioned tables support parallel queries, which returns results faster.
Data management
Old data could be easily archived or deleted.
Isolation and security
Fine-grained permission management could be performed based on partitions, and different users could access different partitions.
PostgreSQL partitioning disadvantages:
Requires additional management overhead.
Complex queries may require multiple accesses to partitions.
Alternatives:
Horizontal Sharding
Split data horizontally across multiple database nodes to improve performance and scalability. Suitable for distributed systems that need to handle large amounts of data.
Archive Tables
Keep the size of the main table small and manageable by regularly migrating old data to archive tables. Access performance to historical data may be affected, but query performance on the main table will improve.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.