我在一张桌子上有一个简单计数的查询。根据下面的屏幕截图,除了单个索引在不同的列上之外,表上没有主键。
如何降低此查询的成本?
即使我在 transactionno 列上创建了一个额外的索引,成本也没有差异。该表有 45 列。表的总大小为 520MB。
CREATE TABLE TBL_COUNT
( ROW_NUMBER NUMBER(22,0) NOT NULL ENABLE,
DATECREATED TIMESTAMP (6),
TRANSACTIONDATE VARCHAR2(64),
TRANSACTIONTIME VARCHAR2(64),
TRANSACTIONNO VARCHAR2(100),
FIRST_NAME VARCHAR2(100),
LAST_NAME VARCHAR2(100),
REG_NO VARCHAR2(30),
EMAIL VARCHAR2(100),
PURCHASE_TYPE VARCHAR2(50),
RA_STATUS VARCHAR2(50),
BSCS_CODE VARCHAR2(20),
ORACLE_ITEM_CODE VARCHAR2(100),
ORACLE_PACKAGE_CODE VARCHAR2(100),
SKU_CODE VARCHAR2(50),
ITEM_DESCRIPTIONS VARCHAR2(100),
MSISDN VARCHAR2(150),
QUANTITY NUMBER(22,0),
UNIT_PRICE NUMBER(22,2),
SERVICE_TAX NUMBER(22,2),
TOTAL_PRICE NUMBER(22,2),
PAYMENT_METHOD VARCHAR2(50),
PAYMENT_CHANNEL VARCHAR2(50),
PAYMENT_MERCHANT_ID VARCHAR2(50),
REGISTER_REGION VARCHAR2(30),
AR_INTERFACESTATUS VARCHAR2(30),
PAYMENT_STATUS VARCHAR2(30),
PAYMENT_DATE VARCHAR2(64),
PAYMENT_TIME VARCHAR2(64),
ISSUING_BANK VARCHAR2(50),
CREDIT_CARD_NO VARCHAR2(50),
CREDIT_CARD_REASON_CODE VARCHAR2(100),
BANK_APPROVAL_CODE VARCHAR2(30),
BANK_REGISTER_REGION VARCHAR2(30),
BANK_REF_NO VARCHAR2(30),
PRIMARY_CONTACT_NO VARCHAR2(30),
ALTERNATE_CONTACT_NO VARCHAR2(30),
REFERENCE_CONTACT_NO VARCHAR2(30),
PRODUCT_UID VARCHAR2(30),
BANK_BIN VARCHAR2(50),
SETTLEMENT_DATE TIMESTAMP (3),
SKU_TYPE VARCHAR2(50),
EXTERNAL_ORDER_NUMBER VARCHAR2(64),
GST_TAX_AMOUNT NUMBER(22,2),
GST_TAX_CODE VARCHAR2(255 )
) TABLESPACE TS ;
CREATE INDEX USER.TBL_COUNT_INDEX ON USER.TBL_COUNT (DATECREATED)
TABLESPACE TS_IDX ;