c# - how to move away from guid fields as primary keys -


i in big mess , looking see if can out of it. have database primary keys on tables defined on uniqueidentifier columns. kind of forced on us, giving 'security' 1 of reasons. other guess comparatively worthier reason of tables participate in replication.

i reviewing database , feel 1 avoidable future performance bottleneck may add auto-increment bigint columns in tables , make them primary keys (clustered). , somehow 'attach' pk-fk relationships properly. still retain old columns future use.

any suggestions/comments/donots in regard? ours c#/mssql server r2/linq environment.

edit: looking @ comments, realize left out few important details. primary key guid fields clustered , no not using newsequentialid (we use linq sql, primary keys generated client side. replication involved, weren't sure of way correctly generate sequential ids different client environments without conflicts).

my 'feeling' due known fact clustered index on guid column cause high degree of fragmentation , worsen situation database grows.

also, not trying optimize right now, trying correct bad design avoid future headaches when database gets large. wanted know if worth doing now.

helpful discussion related issue here in this post, , another

performance tuning database simple, it's hard. first, need gather list of statements being executed against database running long-running profile on course of @ least 1 business day, ideally two.

save profile database can queried, , can find distinct queries executed against database.

after determining ones execute most, analyze execution plans, it's has nothing guid's , everything either queries (i.e. they're terrible) or need different index.

things watch out for:

  1. views heavily filtered where clause. these fantastic candidates either stored procedures or parameterized views.
  2. statements join large tables, at times can candidates sub-queries instead. depend on execution plan.
  3. statements appear executed multiple times. sign application isn't doing job managing how makes round-trips server. i've seen applications run same query 10+ times.

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -