SQL Server Index Fill Factor
How to specify the index option, fe FILLFACTOR?
CREATE NONCLUSTERED INDEX [IX_Name] ON [dbo].[Demo]
(
[Name] ASC
)
WITH (FILLFACTOR = 80) ON [PRIMARY]
modelBuilder.Entity<Demo>(entity =>
{
entity.HasKey(e => e.Gid);
entity.HasIndex(e => e.Name).HasName("IX_Name");
});
@bender-ristone I will discuss with the team, but I don't think there is currently a way to express this in EF Core. You may need to edit the generated migration and write the SQL above explicitly.
@ajcvickers
I started to do something about it, could you look and tell me if that would be the way before sending PR?
https://github.com/ralmsdeveloper/EntityFrameworkCore/commit/1fbcf5c871589b46fef96858cd2491cffca48676
FYI:
- Support is only for the SQL Server provider.
/cc: @bricelam
@ralmsdeveloper Looks reasonable. @roji @bricelam Is fill-factor SQL Server-specific?
@ajcvickers, first thanks for looking, I will still improve some things, this is a draft.
Is fill-factor SQL Server-specific?
Is not SQL Server specific, PostgreSQL also supports Fill Factor.
As other banks databases do not have support, I thought of working with annotation, otherwise we will need to create another property in DatabaseIndex.
Yeah, the SQL Server and PostgreSQL CREATE INDEX syntax even seems to be identical for fill factor (when has that ever happened??).
MySQL (InnoDB) also has this concept, although at the database level only (didn't find anything for Sqlite).
I'm not sure it makes sense to introduce this into relational, as for now we're seeing support in 2 database out of 4...
Removing from the backlog to discuss whether this should be provider-specific or not.
@ralmsdeveloper We discussed and agreed that this is fine to be in the SQL Server provider. We'll follow up on the PR. Thanks!