News for hackers. Stuff that matters.
Re:Announcing SQL Server on Linux by us0r on Tuesday March 08, 2016 @02:57AM (#11244035)
SELECT DATEPART(month,GETUTCDATE()) ? Either you are using a very old version or not using SQL Server at all cause I pretty much do everything you are complaining about on a daily basis and on a very large set of data.
Re:Announcing SQL Server on Linux by tyfon on Tuesday March 08, 2016 @03:22AM (#11244098)
Your query only extracts the month integer from a date, it does not floor it to the month. The equivalent for sql server is this ugly thing: select dateadd(month,datediff(month,0,getdate()),0)

We are on SQL server 2014. I have had a query go from 2-3 hours down to 7 minutes by replacing left joins with subselects within the query for instance (and yes all the indices are in place as recommended by sql server query planer)

The one with a insert based on a query on the same table I have never managed to run at all and I have to use a temporary table as an intermediary instead.

Re:Announcing SQL Server on Linux by Lozzer on Tuesday March 08, 2016 @06:08AM (#11244632)
The last one might be heped by trace flag 4199. You can apply it to individual queries with option (querytraceon 4199):

https://blogs.msdn.microsoft.com/psssql/2010/09/01/slow-quer...

Re:Announcing SQL Server on Linux by advocato on Tuesday March 08, 2016 @08:31AM (#11245055)
I have seen Sql server query planer do stupid shit too. Almost always Statistics where to blame. Are you sure those where up to date? For some reason the "auto update statistics" functionality doesn't seem to work reliably, you have to update them in a maintenance job to fix this.