sql-server-performance

Are there any way to programmatically execute a query with Include Actual Execution Plan and see whether any index suggestion or not

房东的猫 提交于 2019-12-28 18:23:10
问题 I have a quite good number of queries and i want to test each of them with Include Actual Execution Plan feature on sql server management studio However it is not possible for me to do this manually for 1m + queries So i wonder can i execute them programmatically (from c#) with Include Actual Execution Plan feature and see whether SQL server suggests any index or not 回答1: First, before I go in to how to get the Actual Execution Plan in code and find the ones that report needing indexes I

Are there any way to programmatically execute a query with Include Actual Execution Plan and see whether any index suggestion or not

回眸只為那壹抹淺笑 提交于 2019-12-28 18:23:09
问题 I have a quite good number of queries and i want to test each of them with Include Actual Execution Plan feature on sql server management studio However it is not possible for me to do this manually for 1m + queries So i wonder can i execute them programmatically (from c#) with Include Actual Execution Plan feature and see whether SQL server suggests any index or not 回答1: First, before I go in to how to get the Actual Execution Plan in code and find the ones that report needing indexes I

stored procedure is execution taking long time in sql server

ε祈祈猫儿з 提交于 2019-12-25 06:38:59
问题 I have a table called Transaction_tbl with more than 400 000 records in it. This is the table structure: CREATE TABLE [dbo].[Transaction_tbl]( [transactID] [numeric](18, 0) IDENTITY(1,1) NOT NULL, [TBarcode] [varchar](20) NULL, [cmpid] [int] NULL, [Locid] [int] NULL, [PSID] [int] NULL, [PCID] [int] NULL, [PCdID] [int] NULL, [PlateNo] [varchar](20) NULL, [vtid] [int] NULL, [Compl] [bit] NULL, [self] [bit] NULL, [LstTic] [bit] NULL, [Gticket] [int] NULL, [Cticket] [int] NULL, [Ecode] [varchar]

different estimated rows on same index operation?

时光毁灭记忆、已成空白 提交于 2019-12-11 03:08:45
问题 Introduction and Background I had to optimize a simple query (example below). After rewriting it several times I recognized that the estimated row count on the one and same index operation differs depending on the way the query is written. Originally the query did a clustered index scan, as the table in production contains a binary column the table is quite large (about 100 GB) and the full table scan takes too much time to execute. Question Why is the estimated row count different on the

Constant SQL Server 80% CPU Utilization

流过昼夜 提交于 2019-12-10 05:24:22
问题 We have a small (for now) Asp.Net MVC 5 website on a dedicated VPS. When I go to the server and fire-up task manager, I see that "SQL Server Windows NT - 64 bit" is using around 80% of CPU and 170MB of RAM and IIS is using 6% CPU and 400MB of RAM. Server Specs are: CPU 1.90Ghz dual core Memory 2GB Windows Server 2012 SQL Server Express 2012 Disk Space: 25GB, 2.35 Free. The database is not very big. Its backup is less than 10MB. I have tried to optimize the website as much as I could. I added

SQL: Find missing hierarchy Folders (Paths) in a table

纵饮孤独 提交于 2019-12-06 07:56:50
问题 I have a table which contains Folders Paths. I need to find all the "gaps" between those folders in the hierarchy. I mean that, if the table contains these 3 folders: 'A' 'A\B\C' 'A\B\C\D\E\F\G' I need to find the following missing folders in the hierarchy: 'A\B' 'A\B\C\D' 'A\B\C\D\E' 'A\B\C\D\E\F' This table contains more than 250,000 records of folders, so we seek for the most efficient way to do so, otherwise the script will be stuck for long time, time we don't have. Comment: I don't have

Constant SQL Server 80% CPU Utilization

≯℡__Kan透↙ 提交于 2019-12-05 11:24:16
We have a small (for now) Asp.Net MVC 5 website on a dedicated VPS. When I go to the server and fire-up task manager, I see that "SQL Server Windows NT - 64 bit" is using around 80% of CPU and 170MB of RAM and IIS is using 6% CPU and 400MB of RAM. Server Specs are: CPU 1.90Ghz dual core Memory 2GB Windows Server 2012 SQL Server Express 2012 Disk Space: 25GB, 2.35 Free. The database is not very big. Its backup is less than 10MB. I have tried to optimize the website as much as I could. I added caching to a lot of controllers and implemented donut caching for quite a lot of controllers. But today

SQL: Find missing hierarchy Folders (Paths) in a table

一笑奈何 提交于 2019-12-04 14:15:40
I have a table which contains Folders Paths. I need to find all the "gaps" between those folders in the hierarchy. I mean that, if the table contains these 3 folders: 'A' 'A\B\C' 'A\B\C\D\E\F\G' I need to find the following missing folders in the hierarchy: 'A\B' 'A\B\C\D' 'A\B\C\D\E' 'A\B\C\D\E\F' This table contains more than 250,000 records of folders, so we seek for the most efficient way to do so, otherwise the script will be stuck for long time, time we don't have. Comment: I don't have list of all folders. What I have are the "root" folders and the "leafs" folders which I need to find

Indexes with included columns, what's the difference?

妖精的绣舞 提交于 2019-12-03 07:01:12
问题 I've never really understood the difference between these two indexes, can someone please explain what the difference is (performance-wise, how the index structure will look like in db, storage-wise etc)? I understand this question is broad, please bear with me on this. I don't really know how to scope it down. Perhaps if you guys start explaining your know-hows I'll get pointers in the right direction enabling me to make the question more narrow? Included index CREATE NONCLUSTERED INDEX IX

Using GUIDs in Primary Keys / Clusted Indexes

不想你离开。 提交于 2019-11-30 20:04:02
I'm fairly well versed in SQL server performace but I constanly have to argue down the idea that GUIDs should be used as the default type for Clusterd Primary Keys. Assuming that the table has a fairly low amount of inserts per day (5000 +/- rows / day), what kind of performace issues could we run into? How will page splits affect our seek performance? How often should I reindex (or should I defrag)? What should I set the fill factors to (100, 90, 80, ect)? What if I were inserting 1,000,000 rows per day? I apologize beforhand for all of the questions, but i'm looking to get some backup for