Forum Replies Created

Viewing 15 posts - 1,501 through 1,515 (of 2,462 total)

  • RE: Slow Query

    GilaMonster (5/14/2015)


    Alan.B (5/14/2015)


    Add a the following WHERE clause to your Query after that and you get a non-clustered index seek (the plan has a slightly lower subtree cost on the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Slow Query

    Why no PK and/or clustered index?

    Add a primary key to ID and you get a clustered index scan:

    CREATE TABLE dbo.tbl_Login_Details(ID INT IDENTITY, Session_SRNO INT, CONSTRAINT PK_Login PRIMARY KEY(ID));

    INSERT dbo.tbl_Login_Details

    SELECT...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Nested Procedure embedded in SSRS

    You are saying that you have a stored procedure with this code in it:

    EXEC PROC udp_TableUpdateALL (This calls 12 separate table updates)

    SELECT * FROM UpdatedTable?

    There is no reason that should...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Missing Column Statistics in tempdb

    Have you checked the data types? Some datatypes can't have statistics...

    From BOL:

    column [ ,…n]

    Specifies the key column or list of key columns to create the statistics on. You can...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL Query

    DECLARE @issues TABLE(Issues varchar(5), Category char(1), IssueDate date);

    INSERT @issues VALUES

    ('I1','A','1/1/2015'),

    ('I2','A','2/2/2015'),

    ('I3','B','2/1/2015'),

    ('I4','C','3/3/2015'),

    ('I5','B','4/3/2015'),

    ('I6','A','5/4/2015');

    SELECT * FROM @issues;

    SELECT

    mo.m,

    A = SUM(CASE WHEN Category = 'A' THEN 1 ELSE 0 END),

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Sql server random slow query

    RECOMPILE and Copying the parameter as a local variable will likely eliminate that possibility of parameter sniffing.

    If you normally get 10-15K reads then it goes up to 1.5M reads,...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need Ammunition for Developers Doing Select *'s

    You can apply what I'm going to show you to your data. If you want to prove that what you are recommending is faster then visual proof is often the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Separating results from 1 column

    First, welcome to SQL Server Central! See the link in my signature line to the article on how to best ask questions here. The small amount of time it takes...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Bulk Delete & Insert

    I don't understand from your explanation what that other table is doing for you.

    Adding to what Bill said - why not remove all indexes and constraints from the table...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: TempDB files i/o issue.

    Hard to say, it could be a lot of things. What I can say for sure is splitting the data into more files will help and separating the ldfs and...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Sum Help

    I have nothing to add to this post except to say that I love the title, "Sum Help". It would be even better if the title was, "I need sum...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: TempDB files i/o issue.

    Tac11 (5/12/2015)


    I ran following Glen Berry's query on my Prod server:

    SELECT DB_NAME(fs.database_id) AS [Database Name], mf.physical_name, io_stall_read_ms, num_of_reads,

    CAST(io_stall_read_ms/(1.0 + num_of_reads) AS NUMERIC(10,1)) AS [avg_read_stall_ms],io_stall_write_ms,

    num_of_writes,CAST(io_stall_write_ms/(1.0+num_of_writes) AS NUMERIC(10,1)) AS [avg_write_stall_ms],

    io_stall_read_ms +...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: The Case for Scalar-valued, User-defined Functions in T-SQL

    I love this article Dwain. Very good work as always. 5 stars from me. I particularly enjoy how your hierarchies example - very clever.

    I do want to add -...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: The Case for Scalar-valued, User-defined Functions in T-SQL

    peter-757102 (5/12/2015)


    It might be my memory...

    I distinctly remember that in the past any function used in a constraint needed to be deterministic.

    Querying a table violates that rule, obviously.

    When did this...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Index on calculated field with UDF?

    Jeff Moden (5/11/2015)


    Alan.B (5/11/2015)


    Yes and Yes no. If you post an example of what you are trying to do specifically we can provide a specific example.

    If you are talking about...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 1,501 through 1,515 (of 2,462 total)