Question : sybase query showplan help

hi i am doing a simple sql something like:

select col1, col2, col3 from table1, table2, table3 where table1.id = table2.id and table2.id = table3.id ..etc.. order by col1

all the tables are joined on their key with proper indexing.

when i run the show plan on this, it has the below for one of the tables, my question is why is it doing an INSERT and using TABLE SCAN?  

I know more info is needed to get the root cause, but just in general why is there an INSERT in a SELECT query and what could be some reasons it's not using the index? thank you


    STEP 2
        The type of query is INSERT.
        The update mode is direct.
        Worktable1 created, in allpages locking mode, for ORDER BY.

        FROM TABLE
            table1            c
        Nested iteration.
        Table Scan.
        Forward scan.
        Positioning at start of table.
        Using I/O Size 16 Kbytes for data pages.
        With LRU Buffer Replacement Strategy for data pages.

Answer : sybase query showplan help

The result set for the query is being inserted into a worktable to be sorted in order to accomplish the ORDER BY directive of your query.

Random Solutions  
 
programming4us programming4us