Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Can SQL query affect my blazor app rendering perfomance?

$
0
0

OVERVIEW

I know this question is obvious but let me give some overview. So I wanted to delete data from multiple tables in my SQL Server database since some of those tables have FKs, constraints, etc... deleting them manually would've been a pain in the head so I made a little script to do all that (I'm using Dapper, btw).

-- Disable restrictions from FKsEXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL';-- Delete data from tablesDELETE FROM dbo.Table1;DELETE FROM dbo.Table2;DELETE FROM dbo.Table3;DELETE FROM dbo.Table4;DELETE FROM dbo.Table5;DELETE FROM dbo.Table6;DELETE FROM dbo.Table7;DELETE FROM dbo.Table8;DELETE FROM dbo.Table9;DELETE FROM dbo.Table10;DELETE FROM dbo.Table11;-- Enable restrictions from FKsEXEC sp_msforeachtable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL';-- Reset Identities counters to 0DBCC CHECKIDENT ('dbo.Table1', RESEED, 0);DBCC CHECKIDENT ('dbo.Table2', RESEED, 0);DBCC CHECKIDENT ('dbo.Table3', RESEED, 0);DBCC CHECKIDENT ('dbo.Table4, RESEED, 0);DBCC CHECKIDENT ('dbo.Table5, RESEED, 0);DBCC CHECKIDENT ('dbo.Table6, RESEED, 0);DBCC CHECKIDENT ('dbo.Table7, RESEED, 0);DBCC CHECKIDENT ('dbo.Table8, RESEED, 0);DBCC CHECKIDENT ('dbo.Table9, RESEED, 0);DBCC CHECKIDENT ('dbo.Table10, RESEED, 0);DBCC CHECKIDENT ('dbo.Table11, RESEED, 0);

THE PROBLEM

This was the script that I ran, after I ran it everything was fine until I started noticing when ever my app rendered data from my database (doing a call to retrieve my data) the render took to show the data took about 2 seconds and before I ran the script wouldn't even took a second it was instantly.

I don't have complex queries, a lot of data or changed my queries in my project and this. Here I show an example of how I show my an example of how I'm rendering my data in the UI:

code

The code explain itself, this is how I'm managing displaying data to the UI and this was rendering in an instant but now like I said before after running that script my rendering takes about 2 seconds to show the data as if I'm running a complex query or something.

WHAT I'VE TRIED

-- Reordering indexesEXEC sp_msforeachtable 'ALTER INDEX ALL ON ? REORGANIZE';-- Updating statistics in all tablesEXEC sp_msforeachtable 'UPDATE STATISTICS ?';

But this doesn't seem to work. Thanks in advance for the help.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>