Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
20 stars 16 forks source link

Add content URL history hash index #133

Closed jevgenijsp closed 1 month ago

jevgenijsp commented 1 month ago

We identified a performance degradation in this query when the table has over 2 million records:

(@contentKey nvarchar(2000))SELECT TOP 1 Id, ContentKey, Urls, CreatedUtc 
                                FROM [dbo].[NotFoundHandler.ContentUrlHistory]
                                WHERE ContentKey = @contentKey
                                ORDER BY CreatedUtc DESC

To address this, we are adding an index on ContentKey using a new column that will store a hash of the ContentKey.

I ran some benchmarks, and as a result, we expect to improve performance by 10x with this approach when the table becomes large.

https://github.com/Geta/geta-notfoundhandler/issues/129

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud