Forum Replies Created

Viewing 15 posts - 736 through 750 (of 6,036 total)

  • RE: Slow query - client or server issue

    3 obvious problems from the plans:

    1) Key lookup on 240k recordset (Object3). Certainly wrong choice of the clustered index.
    2) 4.3 mil rows scanned from Object4.Index4 only to...

  • RE: Query Optimization Advice

    As I said - it was only 1 randomly chosen piece of the query, picked only because I stopped scrolling through the query to take a sip of coffee.

    Every other...

  • RE: Query Optimization Advice

    From somewhere inside the query:

      FROM [dbo].[FctCoverageLengthDetail]

    WHERE CASE

         WHEN([CoverageLengthMonthNumber]=13 or[CoverageLengthMonthNumber] =25 or[CoverageLengthMonthNumber] =37 or[CoverageLengthMonthNumber] =49

         or[CoverageLengthMonthNumber] =61 or[CoverageLengthMonthNumber]...

  • RE: Query help

    Luis Cazares - Thursday, November 30, 2017 2:12 PM

    Just a different option, for the fun:

    DECLARE @Sample TABLE(
      patients_ID int,
      treatment_ID...

  • RE: Query help

    sgmunson - Thursday, November 30, 2017 2:32 PM

     Brain is not working so well today.

    At least you have one...
    🙂

  • RE: Query help

    No, it won't miss them.

    Because of LEFT join all the treatments which are not in the base set will be simply omitted.

  • RE: Query help

    See if it makes sense:

    create table #PatientTreatment (
    patientID int,
    TreatmentID int
    )

    insert into #PatientTreatment
    select 1, 111
    union
    select 1, 222
    union

  • RE: Force execution plan in a view

    If returned sets are always filtered by PVID you may use this trick:

    CustomData = ROW_NUMBER() OVER (PARTITION BY PVID ORDER BY (SELECT NULL))

  • RE: Speed up query execution. Can we add an index or rewrite the query

    The query returns every single record from the "Allocations" table joined to every single relevant record in lookup tables.
    Since you've got no record filtering, it may be only table...

  • RE: Choosing the Birthday of a Customer by month?

    I'd assume that "birthdays next month" is not only kind of queries which might be performed in the company.
    I'd expect also "birthdays next week", "birthdays on Chritmas holidays", etc.

  • RE: Choosing the Birthday of a Customer by month?

    Jeff Moden - Tuesday, November 21, 2017 8:46 PM

    If finding rows by birth month without regard to year or day is something...

  • RE: Indexing Issue

    tfeuz - Wednesday, November 15, 2017 3:14 PM

    2. Clustered index - every operation the user can perform on this data is...

  • RE: Indexing Issue

    Ok, from what you're saying I can see several key issues.

    1. It's all in a single table . Big mistake. Huge.

    Manufacturer references, vendor catalogue data, sales qty and pricing, reps...

  • RE: Indexing Issue

    Are you trying to tell that the query

    INSERT INTO #ChangeProducts ()

    SELECT ...

    FROM Joined Tables

    With no WHERE filter

    Performs better and applies less intensive locking than

    SELECT ...

    FROM Joined...

Viewing 15 posts - 736 through 750 (of 6,036 total)