Forum Replies Created

Viewing 15 posts - 916 through 930 (of 7,613 total)

  • Reply To: Create constraint using index

    Sergiy wrote:

    CREATE UNIQUE INDEX IX_ID2 ON  #IndexTEST(ID2) INCLUDE (ID);

    creates unique constraint, exactly as you requested.

    Second statement is not needed at all.

    Technically that's just a unique index,...

    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".

  • Reply To: SS2019 Running Extremely Slow

    The indexes will come along.  Since they are part of the db, they get restored with it.

    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".

  • Reply To: SS2019 Running Extremely Slow

    For more specific tuning, yes, we must see the query plan and the DDL for the table(s) involved, including all 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".

  • Reply To: SS2019 Running Extremely Slow

    water490 wrote:

    ScottPletcher wrote:

    water490 wrote:

    Cost Threshold for Parallelism = 5

    Max Degree of Parallelism = 12

    Are these values correct?

    Definitely not for the first one.  Bump that up to at least 40:

    EXEC sys.sp_configure...

    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".

  • Reply To: Having a case or if statement in where clause on Max Date

    Note the "<" in the comparison; that is required.  This handles due_date correctly whether it is a datetime data type or a date.

    ;WITH cte_get_max_due_date 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".

  • Reply To: SS2019 Running Extremely Slow

    --Removed, double post.

    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".

  • Reply To: SS2019 Running Extremely Slow

    water490 wrote:

    Cost Threshold for Parallelism = 5

    Max Degree of Parallelism = 12

    Are these values correct?

    Definitely not for the first one.  Bump that up to at least 40:

    EXEC sys.sp_configure 'cost threshold...

    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".

  • Reply To: Healthcare / Medical sample database?

    I have extensive experience in health care as well.  Experience directly in that field is in fact very useful.

    Obviously industry terms may be different and have different connotations in each...

    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".

  • Reply To: Obtaining Restore Begin Date and End Date to calculate the duration

    Look at table msdb.dbo.restorehistory.

    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".

  • Reply To: Performance related issue after using left join to bring new fields to the query

    You can clean up the existing code some, but the condition:

    Prop_TYPE NOT LIKE '%Rond%'

    is still going to require a table scan or a covering index scan (if a covering index...

    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".

  • Reply To: Create constraint using index

    I don't believe SQL will use an existing index for a constraint, even if the index perfectly matches the constraint to be added.

    In your situation, the index and the constraint...

    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".

  • Reply To: Measuring Ad-hoc workload on a per database level

    (1) Did you set on the "optimize for ad-hoc workloads" SQL Server setting?

    (2) What is the "threshold for parallelism setting"?  In particular, did you leave it at the default of...

    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".

  • Reply To: Trying to re-id a database table and getting error on the first select keyword

    Mr. Brian Gale wrote:

    I just wanted to add in that I am not a big fan of the "SELECT * INTO" approach to table creation.  It recreates the table, but only 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".

  • Reply To: Slow Sql server

    Typically I/O causes the most issues.

    Therefore, another first quick thing to do is to look at the queries with the TOP (10) Avg I/O.  You can find these from SSMS.

    Right-click...

    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".

  • Reply To: Stored Procedure Performance

    Sorry, I wasn't being clear before about how to use transactions here.

    If there are no BEGIN TRAN / COMMIT TRAN, then every modification (DELETE / INSERT / UPDATE) will be...

    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 - 916 through 930 (of 7,613 total)