Forum Replies Created

Viewing 15 posts - 3,316 through 3,330 (of 7,613 total)

  • RE: Getting suggestion for non-clustered index on a table with a clustered columnstore index (2016) -- need to understand how they relate

    As with any nonclus index, SQL estimating that too many pages will be needed from the nonclus index causes SQL to drop back to just scanning the main table.  I...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Clustered PK perf -

    Chris Harshman - Tuesday, June 19, 2018 3:16 PM

    ranitb - Tuesday, June 19, 2018 8:27 AM

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Clustered PK perf -

    ranitb - Tuesday, June 19, 2018 12:58 PM

    You really should strongly consider defining the clus index before loading the table if at all possible
    >...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Getting suggestion for non-clustered index on a table with a clustered columnstore index (2016) -- need to understand how they relate

    For the CCI, SQL will effectively have to scan all the rows for every query.  If you can a nonclus index, SQL may be able to just do lookups to...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Long running query

    Agree with Luis, except even more strongly:
    We must see the DDL for the tables, including all indexes.
    It would also be nice to see usage stats for those indexes,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SARGability of query

    Also, consider clustering dbo.MyTable on (ValidUntil, CreatedOn) or adding ValidUntil to the nonclus index. [You don't have to cluster tables by identity, and it can actually be quite harmful to...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Joining a large table to itself....better ideas?

    xsevensinzx - Tuesday, June 19, 2018 6:01 AM

    Jeff Moden - Tuesday, June 19, 2018 1:06 AM

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Clustered PK perf -

    If you (almost) always join on all the keys, then yes, cluster on all of them.

    You really should strongly consider defining the clus index before loading the table...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Joining a large table to itself....better ideas?

    Given that a matched pickup and dropoff won't change in the future, when a dropoff gets entered, have a trigger link it to its pickup (store the pickup key(s) in...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Return last amount larger than 0

    I'd check column separately rather than adding them, just in case negative amounts could appear now, or somehow do appear later:

    WHERE CE.CLOSING_CREDITS <> 0 AND CE.CLOSING_DEBITS <> 0

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Friday Fun - Excel Formula to SQL Functions

    Also, you want to avoid BETWEEN when dealing with dates / times.
    I have heard this often but I have never seen any proof as to why. I am...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Top 2 records with range


    SELECT TOP (2) IDUser, Score, Name
    FROM (
      SELECT U.IDUser, U.Score, U.RecordDt, S2.Name,
          ROW_NUMBER() OVER(PARTITION BY U.IDUser, S2.Name ORDER BY U.RecordDt DESC) AS...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Friday Fun - Excel Formula to SQL Functions

    I think something like below is much easier to follow.  Also, you want to avoid BETWEEN when dealing with dates / times.

    I can't tell for sure if the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Join on a substring value

    Or, better yet, just go back to properly using 1NF in the table and store all values as atomic, i.e., individual columns.  The computed column should be the concatenated value,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: carving out bussiness hours.

    DesNorton - Tuesday, June 12, 2018 12:07 PM

    This should give you the the AVG per day as well as the AVG for...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 3,316 through 3,330 (of 7,613 total)