sqlperformance Questions

4

I have a database in SQL Azure which is not taking between 15 and 30 minutes to do a simple: select count(id) from mytable The database is about 3.3GB and the count is returning approx 2,000,000...
Zebe asked 14/9, 2014 at 7:47

9

When should I use KEY, PRIMARY KEY, UNIQUE KEY and INDEX?
Caldarium asked 2/10, 2010 at 8:5

1

Solved

What happens if two transactions try to modify the same row simultaneously? Normally, once the row is modified, the other transaction waits until the first one performs commit or rollback. But what...

1

We had a weird issue in development and are looking for an explanation on a self-deadlock issue with a SELECT INTO on a temp table. We have a routine to transform some fairly complicated JSON docum...

2

Solved

I have a table with 10 millions rows that I need to join with another table and update all data. This is taking more than 1 one hour and it is increasing my transaction log in 10+ GBs. Is there ano...
Tampon asked 13/1, 2015 at 23:44

4

Solved

this a poor performancing query I have ... what have I done so wrong? Please help me it is executed tons of times in my system, solving that will give me a ladder to heaven I gave a check on the s...
Gangrel asked 21/12, 2018 at 12:1

3

Solved

I have the following Chained CTE query (simplified): ;WITH CTE1 AS( SELECT * FROM TableA ), CTE2 AS( SELECT * FROM TableB b INNER JOIN CTE1 c ON b.id = c.id ) SELECT * FROM CTE2 If I break C...

1

I have a presto cluster configured with 12 workers that is being queried by Java applications. The cluster is capable of performing 30 concurrent requests (if there are more, they are queued). The...
Datha asked 12/7, 2018 at 9:20

1

Solved

This is a follow-up question to Retrieving last record in each group from database - SQL Server 2005/2008 In the answers, this example was provided to retrieve last record for a group of parameter...
Fully asked 22/5, 2018 at 11:56

2

I have following queries: DECLARE @application_number CHAR(8)= '37832904'; SELECT la.LEASE_NUMBER AS lease_number, la.[LEASE_APPLICATION] AS application_number, tnu.[FOLLOWUP_CODE] AS note_type...

3

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: Addi...
Contrastive asked 27/9, 2014 at 9:5

2

Solved

I have a web application that use a SQL Server database that is shared with others web applications (over which I have no control). I must know when any of the web apps makes changes to some tables...
Modiolus asked 26/9, 2016 at 17:58

1

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` ...
Yahiya asked 8/11, 2016 at 14:26

2

I have a performance query nearest stores: We have a table that contains around 50,000 records (stores/point of sale locations) in one country. Each record has location columns of type "geography...
Ermey asked 23/12, 2016 at 15:2

1

Solved

Given the next SQL statement: Select * from A join B on A.id1=B.id1 and A.id2=B.id2 where A.year=2016 and B.year=2016 and knowing table A is much smaller than table B, so I need the datab...
Modal asked 21/12, 2016 at 12:56

5

Solved

summary: I've seen a lot of advice against using SELECT * in MS SQL, due to both performance and maintainability concerns. however, many of these posts are very old - 5 to 10 years! it seems, from ...
Tungstic asked 2/9, 2016 at 15:29

1

Solved

Is writing session.createCriteria(Person.class) .add(Restrictions.eq("id", personId)) .setMaxResults(1) .uniqueResult(); better than writing session.createCriteria(Person.class) .add(Restric...
Hulen asked 23/3, 2016 at 10:24

8

Solved

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 l...
Parting asked 19/8, 2009 at 21:18

5

Solved

SELECT Trade.TradeId, Trade.Type, Trade.Symbol, Trade.TradeDate, SUM(TradeLine.Notional) / 1000 AS Expr1 FROM Trade INNER JOIN TradeLine ON Trade.TradeId = TradeLine.TradeId WHERE (TradeLine.Id ...
Smith asked 11/5, 2011 at 20:39

2

Solved

The documentation for sys.dm_db_missing_index_group_stats uses the terms "user queries" and "system queries" but it doesn't define what those mean. For example: user_seeks: "Number of seeks cause...

3

I have one small doubt in query performance. Basically, I have a table with more than 1C records. sl_id is the primary key in that table. Currently, I am updating the table column status to true (d...
Minh asked 9/7, 2014 at 7:17

1

Solved

Up until now my foreign keys have always been uniqueidentifiers or an int. Would it impact performance negatively if I used a nvarchar field as a foreign key? Are there any other considerations I ...
Allantois asked 26/2, 2014 at 5:21

1

Solved

I've just recently become aware of the fact that you can now index your views in SQL Server (see http://technet.microsoft.com/en-us/library/cc917715.aspx). I'm now trying to figure out when I'd get...
Freeze asked 24/12, 2013 at 15:20

1

Solved

Does the order of the values in a WHERE IN clause matter? (this is on Firebird SQL if that is important) Such as does: where field1 in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) offer a performance increa...
Swords asked 29/4, 2013 at 1:39

1

Solved

I'm running some aggregation queries on some very large tables in an OLAP environment. I'm currently bottlenecked by disk IO at 200 MB/s. I'm doing these queries on a machine with 92 GB of RAM. Is...
Crookes asked 26/2, 2013 at 17:41

© 2022 - 2024 — McMap. All rights reserved.