Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)

  • RE: need help with query speed.

    is it ok to have a clustered index on recorddate? I have two rows per device per day for the recorddate.

  • RE: need help with query speed.

    this is how devicehistory is indexed

    indexes on the devicehistory table are as follows:

    primary key = id

    recorddate ascending = non unique, non clustered

    datesubmitted ascending = non unique, non clustered

    archived ascending =...

  • RE: need help with query speed.

    I havent had a chance to setup a test environment yet. I was hoping to find something a little simpler to do, but it doesnt seem that there will be!

  • RE: need help with query speed.

    just wanted to bump and get any other suggestions before I try what Vic has recommended.

  • RE: need help with query speed.

    vicdileo (5/4/2012)


    My suggestion for exploring indexed views is based on the query plans you provided which indicate that the indexes are being used in your query (I didn't see any...

  • RE: need help with query speed.

    sorry, I misunderstood.

    here are two of them. explan is the original query, and explan1 is a larger version of the query that took 4 minutes to run.

  • RE: need help with query speed.

    vicdileo (5/1/2012)


    RE:

    8) if so, then what does the query plan look like when your WHERE IN has 16,000 deviceid's?

    its actually 1600+, Ive attached one for 720 devices

    I don't see the...

  • RE: need help with query speed.

    Lynn Pettis (5/1/2012)


    First, how quickly does the following run:

    SELECT

    deviceid,

    archived,

    AVG(CASE WHEN recorddate > DATEADD(day, -7, getDate()) THEN d2.estgasvolmcf ELSE...

  • RE: need help with query speed.

    7) does the query plan you provided come from the same query that appears in your post?

    yes

    8) if so, then what does the query plan look like when your...

  • RE: need help with query speed.

    vicdileo (5/1/2012)


    Thanks for providing the query plan and other info.

    Regarding the query plan:

    I don't see any table scans, so that's good.

    It looks like the query plan is probably not being...

  • RE: need help with query speed.

    Lowell (5/1/2012)


    two issues i see:

    two different WHERE statements have a function on a datetime column...

    WHERE DATEADD(day, 15, time) > GETDATE()

    --and later:

    AND CONVERT(DATE, recorddate) = '2012-04-25'

    this requires SQL to do...

  • RE: need help with query speed.

    1) Copy the plan and post it here.

    attached

    How is this query being run:

    2) As a stored procedure?

    no

    3) AS embedded SQL in a C# program or Java, etc.?

    yes, java

    4) Is this...

  • RE: need help with query speed.

    bump. can anyone point me in the right direction?

Viewing 13 posts - 1 through 13 (of 13 total)