我的问题涉及 Oracle 11gr2 和 SQL 查询中索引的使用。请帮助我解决以下问题,我无法在此查询中使用索引:
SELECT ListingManagerID,
FirstName,
LastName,
PrimaryPhone,
AlternatePhone,
Email,
UserName,
Password,
RecallGuid,
CustomerSince,
PWChangeRequired,
PWExpireDate,
CallingHours,
CreateDate,
CreateIPAddress,
LastLogin,
AutoRenewFlag,
LastUpdated,
UpdatedBy,
AutoRenewRemovedDate,
AutoRenewDate,
isSupplier,
PrefferedLanguage,
AboutMe,
PictureFilePath,
IsProfilePictureDisplay,
LocaleID,
Address1,
Address2,
CityID,
CountryID,
StateProvinceID,
PostalCode,
RegistrationSource,
PPCTypeID,
GhostUser,
ProfileId,
TimezoneID,
OCA
FROM ListingManager
WHERE trim(lower(LISTINGMANAGERID)) = 'e.kkagacoe4aaae7rnr9lua5'
- 创建索引
SQL> CREATE INDEX IDX_LISTINGMANAGER_ID ON listingmanager (LOWER(listingmanagerid));
已创建索引。
- 收集统计数据
SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('INTERSHOP', 'LISTINGMANAGER' , CASCADE=>TRUE);
PL/SQL 过程成功完成。
索引是在 上创建的Listingmanager Column
,但执行计划仍然显示全表扫描。我不知道为什么仍然会发生全表扫描。
ListingManagerID 是表的主键,我可以修改主键创建的索引吗?
PLAN_TABLE_OUTPUT
--------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
--------------------------------------------------
| 0 | SELECT STATEMENT | | 2013 | 487K| 1784 (1)|
|* 1 | TABLE ACCESS FULL| LISTINGMANAGER | 2013 | 487K| 1784 (1)|
谓词信息(由操作 id 标识):
1 - filter(TRIM(LOWER("LISTINGMANAGERID"))='e.kkagacoe4aaae7rnr9lua5' )
谢谢