加入Sybase时,索引未使用

时间:2015-07-21 14:46:06

标签: indexing sybase using

QUERY:

select    b.cusip   
from    StanDb..bond_identifier b, EnigmaDb..cpm_filter c
where   b.identifier_code = c.identifier_code
and     b.identifier_value like c.identifier_value

索引:

create unique nonclustered index cpm_filter_idx01 
on EnigmaDb.dbo.cpm_filter(identifier_code, identifier_value)

create unique clustered index x1 
on StanDb.dbo.bond_identifier(cusip, identifier_code)

create nonclustered index x2 
on StanDb.dbo.bond_identifier(identifier_code, identifier_value)

查询计划:

陈述1的查询计划(第1行)。

STEP 1
    The type of query is SELECT.

    FROM TABLE
        EnigmaDb..cpm_filter
        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.

    FROM TABLE
        StanDb..bond_identifier
        b
    Nested iteration.
    Index : x2
    Forward scan.
    Positioning by key.
    Keys are:
        identifier_code  ASC
        identifier_value  ASC
    Using I/O Size 16 Kbytes for index leaf pages.
    With LRU Buffer Replacement Strategy for index leaf pages.
    Using I/O Size 16 Kbytes for data pages.
    With LRU Buffer Replacement Strategy for data pages.

执行时间:0.028秒

我的问题是,联接查询中的第二个表是使用全表扫描而不是索引扫描。

有人可以帮助我理解这一点。

0 个答案:

没有答案