Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:20:41+00:00 2026-06-15T10:20:41+00:00

We use mini profiler in two ways: On developer machines with the pop-up In

  • 0

We use mini profiler in two ways:

  1. On developer machines with the pop-up
  2. In our staging/prod environments with SqlServerStorage storing to MS SQL

After a few weeks we find that writing to the profiling DB takes a long time (seconds), and is causing real issues on the site. Truncating all profiler tables resolves the issue.

Looking through the SqlServerStorage code, it appears the inserts also do a check to make sure a row with that id doesnt already exist. Is this to ensure DB agnostic code? This seems it would introduce a massive penalty as the number of rows increases.

How would I go about removing the performance penalty from the performance profiler? Is anyone else experiencing this slow down? Or is it something we are doing wrong?

Cheers for any help or advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:20:42+00:00Added an answer on June 15, 2026 at 10:20 am

    Hmm, it looks like I made a huge mistake in how that MiniProfilers table was created when I forgot about primary key being clustered by default… and the clustered index is a GUID column, a very big no-no.

    Because data is physically stored on disk in the same order as the clustered index (indeed, one could say the table is the clustered index), SQL Server has to keep every newly inserted row in that physical order. This becomes a nightmare to keep sorted when we’re using essentially a random number.

    The fix is to add an auto-increasing int and switch the primary key to that, just like all the other tables (why I overlooked this, I don’t remember… we don’t use this storage provider here on Stack Overflow or this issue would have been found long ago).

    I’ll update the table creation scripts and provide you with something to migrate your current table in a bit.

    Edit

    After looking at this again, the main MiniProfilers table could just be a heap, meaning no clustered index. All access to the rows is by that guid ID column, so no physical ordering would help.

    If you don’t want to recreate your MiniProfiler sql tables, you can use this script to make the primary key nonclustered:

    -- first remove the clustered index from the primary key
    declare @clusteredIndex varchar(50);
    
    select  @clusteredIndex = name
    from    sys.indexes
    where   type_desc = 'CLUSTERED'
            and object_name(object_id) = 'MiniProfilers';
    
    exec ('alter table MiniProfilers drop constraint ' + @clusteredIndex);
    
    -- and then make it non-clustered
    alter table MiniProfilers add constraint 
      PK_MiniProfilers primary key nonclustered (Id);
    

    Another Edit

    Alrighty, I’ve updated the creation scripts and added indexes for most querying – see the code here in GitHub.

    I would highly recommended dropping all your existing tables and rerunning the updated script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use Mini-Profiler with Simple.Data Library? I use it to get
I'm trying to use the mvc-mini-profiler with EFCodeFirst I'm creating a DbProfiledConnection and passing
I am trying to use the mvc-mini-profiler with MVC3 and keep getting the following
Is it possible to use the mini profiler in service stack with the razor
I'm trying to use the mvc-mini-profiler in my mvc application. I created a wrapper
I'm trying to use the mini-profiler with old-style EF code - database-first. So far:
I use EF 4.2 code first in my mvc3 project. miniprofiler works fine (sql
The ASP.NET MVC Mini Profiler looks awesome, but I don't get the Linq 2
I'm trying to use code similar to clrdump to create mini dumps in my
I tend to use enums to create mini data tables all over my code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.