Forum Replies Created

Viewing 15 posts - 1,726 through 1,740 (of 7,613 total)

  • Reply To: Using REVERSE

    Jeff Moden wrote:

    ScottPletcher wrote:

    You don't really need a pk or any other column from the main table.  Also, I assumed you're rather see blank than NULL for missing levels, but if...

    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: COUNT(ID COLUMN) not using Clustered Index

    Lord Slaagh wrote:

    Hello SSC,

    ... When I run... SELECT CustomerID, execution plan shows that it is hitting the correct Clustered Index.

    Dave

    Hmm, that doesn't seem right.  You must have added other columns 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".

  • Reply To: COUNT(ID COLUMN) not using Clustered Index

    Jeff Moden wrote:

    Although the PK is frequently also the clustered index, it's not necessarily so.  The keys of non-clustered indexes include the keys of the clustered index, which isn't necessarily 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: Using NOLOCK in UPDATE or DELETE

    I manage hundreds of prod dbs (and hundreds of qa ones) and I have roughly a dozen that have RCSI.  The overhead is just so high.  [And if you want...

    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: Using REVERSE

    You don't really need a pk or any other column from the main table.  Also, I assumed you'd rather see blank than NULL for missing levels, but if not, just...

    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: Using REVERSE

    First, you should encode the string values to a numeric equivalent.  Imagine what must happen now when the name of a level changes.  For example, say that "Outdoor Accessories" had...

    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: Including certain columns creates long query time

    For just that specific column, you need to rebuild one of the existing indexes:

    CREATE NONCLUSTERED INDEX [IX_game_boxscore_players_personID] 
    ON [mlb_json].[game_boxscore_players] ( [boxscore.players.person.id] )
    ...

    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: Including certain columns creates long query time

    Need to see the DDL including the index definitions for all tables in the query.

    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: Using NOLOCK in UPDATE or DELETE

    ScottPletcher wrote:

    ScottPletcher wrote:

    MMartin1 wrote:

    I still have to wonder on the appropriate use of NOLOCK. Even if the data does not change in a table, is NOLOCK...

    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: Using NOLOCK in UPDATE or DELETE

    ScottPletcher wrote:

    MMartin1 wrote:

    I still have to wonder on the appropriate use of NOLOCK. Even if the data does not change in a table, is NOLOCK that much better...

    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: Query optimisation/execution plan

    For these specific queries alone -- since we know nothing else about this table -- you should change the clustering key on the table shown.

    CREATE TABLE dbo.CustTravelReqLocPlan (

    ...

    CONSTRAINT [PK__CustTrav__401DC63546C0E5F6] PRIMARY...

    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: SQL Agent Job is stuck

    It seems there must be some error occurring when the script it exec'd.  Add some msgs to (1) verify if this is true and (2) if so, show the return...

    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: View using Cross Join and LIKE operator please suggest alternate syntax.

    (1) CROSS JOIN is not necessarily bad for performance.  If the CJ'd table is single row, it's definitely fine.

    (2) The %s are OK here, since there's no easier way 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".

  • Reply To: Compress the Partitioned OR Partition the Compressed ?

    Yes, both can make a big difference in OLTP as well.  The key is that it reduces I/O because fewer pages must be written to disk.

    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: Non clustered Index on #temp table

    Vastly better to instead create a clustered index before you load the temp 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".

Viewing 15 posts - 1,726 through 1,740 (of 7,613 total)