问题
I have a WCF Data Service running on top of a Entity Framework code first 4.1 provider. The database is quite large (one key table has 77+ million records and grows by ~10% per month) and has presented quite a performance problem. While sharding a database that large is a pain it seems inevitable. My question is, has anybody successfully implemented EF with a sharded database and, if so, do you have any guidance?
回答1:
Have you investigated the following options:
- Clustering your DB (I assume it's SQL Server you are using)?
- Extracting some of your data (archived records, for example) into another table, then create a view with a UNION query to join the two tables together when you need a complete dataset view?
- Does your table have indices on it - if not, have you tried creating one?
回答2:
You can scale out databases with the MS shard map manager.
See Elastic database tools https://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-introduction/
and in particular Shard map manager https://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-shard-map-management/
来源:https://stackoverflow.com/questions/9540901/entity-framework-and-sharded-database