• souLTower (1/23/2013)


    I have a huge DB and a view that pulls records from multiple tables, some as big as 2M records. I have great indexes. I can query: select from myView where fldValue = 123.

    It returns 3K records in .3 seconds. Happy. Now I need to return data for multiple fldValue values.

    Select from myView where fldValue IN (123,456,789)

    Works great. However this stinks:

    Select from myView V inner join myTemp T ON V.fldValue = T.fldValue

    So for a test, I reduced the temp table to one record. Still falls on its face. I have a few whacky solutions. My question is, why would this happen and is there a non whacky way to make the join to the temp table perform correctly?

    Thanks

    ST

    What's the DDL for that temp table? Do you have the same PK and indexing on the temp table as you do on the tables underlying the view? Or are you leaving the temp table in a heap?

    Roland Alexander 
    The Monday Morning DBA 
    There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer