sqlperformance

How bad is opening and closing a SQL connection for several times? What is the exact effect?

北慕城南 提交于 2019-12-01 08:38:43
For example, I need to fill lots of DataTables with SQLDataAdapter's Fill() method: DataAdapter1.Fill(DataTable1); DataAdapter2.Fill(DataTable2); DataAdapter3.Fill(DataTable3); DataAdapter4.Fill(DataTable4); DataAdapter5.Fill(DataTable5); .... .... Even all the dataadapter objects use the same SQLConnection, each Fill method will open and close the connection unless the connection state is already open before the method call. What I want to know is how does unnecessarily opening and closing SQLConnections affect the performance of the application. How much does it need to scale to see the bad

SQL Server : MERGE performance

梦想与她 提交于 2019-12-01 08:16:21
I have a database table with 5 million rows. The clustered index is auto-increment identity column. There PK is a code generated 256 byte VARCHAR which is a SHA256 hash of a URL, this is a non-clustered index on the table. The table is as follows: CREATE TABLE [dbo].[store_image]( [imageSHAID] [nvarchar](256) NOT NULL, [imageGUID] [uniqueidentifier] NOT NULL, [imageURL] [nvarchar](2000) NOT NULL, [showCount] [bigint] NOT NULL, [imageURLIndex] AS (CONVERT([nvarchar](450),[imageURL],(0))), [autoIncID] [bigint] IDENTITY(1,1) NOT NULL, CONSTRAINT [PK_imageSHAID] PRIMARY KEY NONCLUSTERED (

How bad is opening and closing a SQL connection for several times? What is the exact effect?

匆匆过客 提交于 2019-12-01 07:20:47
问题 For example, I need to fill lots of DataTables with SQLDataAdapter's Fill() method: DataAdapter1.Fill(DataTable1); DataAdapter2.Fill(DataTable2); DataAdapter3.Fill(DataTable3); DataAdapter4.Fill(DataTable4); DataAdapter5.Fill(DataTable5); .... .... Even all the dataadapter objects use the same SQLConnection, each Fill method will open and close the connection unless the connection state is already open before the method call. What I want to know is how does unnecessarily opening and closing

SQL Server : MERGE performance

大憨熊 提交于 2019-12-01 05:46:31
问题 I have a database table with 5 million rows. The clustered index is auto-increment identity column. There PK is a code generated 256 byte VARCHAR which is a SHA256 hash of a URL, this is a non-clustered index on the table. The table is as follows: CREATE TABLE [dbo].[store_image]( [imageSHAID] [nvarchar](256) NOT NULL, [imageGUID] [uniqueidentifier] NOT NULL, [imageURL] [nvarchar](2000) NOT NULL, [showCount] [bigint] NOT NULL, [imageURLIndex] AS (CONVERT([nvarchar](450),[imageURL],(0))),

Using tuple comparison in mysql is it efficient?

情到浓时终转凉″ 提交于 2019-12-01 00:20:54
问题 I have a table of books : CREATE TABLE `books` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `nameOfBook` VARCHAR(32), `releaseDate` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `Index 2` (`releaseDate`, `id`) ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB AUTO_INCREMENT=33029692; I compared two SQL requests to do a pagiation with sort on releaseDate. Both of theses request return the same result. (simple one) select SQL_NO_CACHE id,name, releaseDate from books where releaseDate <= '2016-11

Simple select count(id) uses 100% of Azure SQL DTUs

允我心安 提交于 2019-11-30 08:53:34
This started off as this question but now seems more appropriately asked specifically since I realised it is a DTU related question. Basically, running: select count(id) from mytable EDIT: Adding a where clause does not seem to help. Is taking between 8 and 30 minutes to run (whereas the same query on a local copy of SQL Server takes about 4 seconds ). Below is a screen shot of the MONITOR tab in the Azure portal when I run this query. Note I did this after not touching the Database for about a week and Azure reporting I had only used 1% of my DTUs. A couple of extra things: In this particular

Combining datasets with EXCEPT versus checking on IS NULL in a LEFT JOIN

我的梦境 提交于 2019-11-29 13:56:33
I'm currently working my way through the Microsoft SQL Server 2008 - Database Development (MCTS Exam 70-433) certification. In one of the earlier chapters on Combining Datasets , I came across the EXCEPT (and INTERSECT ) commands. One example shows how to use EXCEPT to get all values from one table that doesn't have a related value in a second table like this: SELECT EmployeeKey FROM DimEmployee EXCEPT SELECT EmployeeKey FROM FactResellerSales The EXCEPT command was new to me, but with what I knew before today I would still easily solve the problem using a LEFT JOIN and check for IS NULL on

SQL Server SELECT INTO and Blocking With Temp Tables

a 夏天 提交于 2019-11-28 18:40:49
So, recently a DBA is trying to tell us that we cannot use the syntax of SELECT X, Y, Z INTO #MyTable FROM YourTable To create temporary tables in our environment, because that syntax causes a lock on TempDB for the duration of the stored procedure executing. Now, I've found a number of things that detail how temporary tables work, scope of execution, cleanup and the like. But for the life of me, I don't see anything about blocking because of their use. We are trying to find proof that we shouldn't have to go through and do CREATE TABLE #MyTable... for all of our temporary tables, but neither

Combining datasets with EXCEPT versus checking on IS NULL in a LEFT JOIN

此生再无相见时 提交于 2019-11-28 07:55:22
问题 I'm currently working my way through the Microsoft SQL Server 2008 - Database Development (MCTS Exam 70-433) certification. In one of the earlier chapters on Combining Datasets , I came across the EXCEPT (and INTERSECT ) commands. One example shows how to use EXCEPT to get all values from one table that doesn't have a related value in a second table like this: SELECT EmployeeKey FROM DimEmployee EXCEPT SELECT EmployeeKey FROM FactResellerSales The EXCEPT command was new to me, but with what I

Database/SQL: How to store longitude/latitude data?

陌路散爱 提交于 2019-11-28 02:58:53
Performance question ... I have a database of houses that have geolocation data (longitude & latitude). What I want to do is find the best way to store the locational data in my MySQL (v5.0.24a) using InnoDB database-engine so that I can perform a lot of queries where I'm returning all the home records that are between x1 and x2 latitude and y1 and y2 longitude . Right now, my database schema is --------------------- Homes --------------------- geolat - Float (10,6) geolng - Float (10,6) --------------------- And my query is: SELECT ... WHERE geolat BETWEEN x1 AND x2 AND geolng BETWEEN y1 AND