Viewing 15 posts - 6,196 through 6,210 (of 49,552 total)
sql-lover (4/11/2015)
I decided I will use count with if exists.
Count has no place in an IF EXISTS check. EXISTS doesn't care about the columns, hence why SELECT 1 is often...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:42 am
sql-lover (4/11/2015)
I am not looking for how many rows exactly I have on a table. I am looking for those tables without any rows.
IF EXISTS (SELECT 1 FROM TableName)
...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:40 am
Alan.B (4/10/2015)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:38 am
jphillips 46546 (4/10/2015)
Agree much less costly to just do a if exists (select top 1 from tablename)
You don't need a TOP 1 in an EXISTS subquery.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:36 am
Sean Lange (4/10/2015)
sql-lover (4/10/2015)
SELECT
t.name table_name,
s.name schema_name,
p.rows AS total_rows
FROM sys.tables t
join sys.schemas s on (t.schema_id = s.schema_id)
join sys.partitions p on (t.object_id = p.object_id)
WHERE...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:35 am
No, you want the equality first and inequality second and it does not depend on cardinality and distribution of the data.
If you put the equality first and the inequality second,...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:34 am
A good backup.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:30 am
Eirikur Eiriksson (4/11/2015)
Does anyone have an idea on how to solve this problem?😎
Extended events or the sys.dm_db_session_space_usage DMV which tracks tempDB usage per session (not per table, just overall space...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:30 am
Luis Cazares (4/10/2015)
http://www.sqlservercentral.com/Forums/FindPost1676220.aspx
But, think about it, what if you're in situation where,...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:27 am
Grant Fritchey (4/10/2015)
Is everyone OK? Are people ill or something? Because this just happened and it has me concerned:
Work deadlines and other stuff. Sorry, will do better next month
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2015 at 2:22 am
SQLRNNR (4/10/2015)
GilaMonster (4/10/2015)
I love finding out that I'm giving a training course from the newsletter sent out the the entire company.That is awesome.
I could use a few other phrases at...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2015 at 9:36 am
RonKyle (4/10/2015)
but by avoiding key lookups, or worse table/index scans
assuming the table is not a heap (which it shouldn't be, right?), why would it (at least as a general rule)...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2015 at 9:17 am
Furthermore, you have a non-optimal query form.
http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2015 at 8:54 am
simon_s (4/10/2015)
Yes person_id is unique , role_id is not
In that case they're pretty much going to behave much the same way for any query that filters on person_id. Use the...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2015 at 8:53 am
Grant Fritchey (4/10/2015)
RonKyle (4/10/2015)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 10, 2015 at 8:52 am
Viewing 15 posts - 6,196 through 6,210 (of 49,552 total)