使用:火鸟 2.52
对于以下查询的 SELECT 性能,我是否需要表中其他字段的索引:
所需查询:
select inventory_id, max(batch_no) from invty_batch
where inventory_id = :I
group by inventory_id
表结构:
CREATE TABLE INVTY_BATCH (
ROW_ID INTEGER NOT NULL,
INVENTORY_ID INTEGER NOT NULL,
BATCH_NO VARCHAR(8) NOT NULL,
INVTYRCPT_ID INTEGER NOT NULL,
UNITPRICE NUMERIC(12, 2) DEFAULT 0.0 NOT NULL);
ALTER TABLE INVTY_BATCH ADD PRIMARY KEY (ROW_ID);
CREATE UNIQUE INDEX IXINVTYIDBATCHNO ON INVTY_BATCH(INVENTORY_ID,BATCH_NO);
在inventory_id 和batch_no 列上创建索引是否会提高给定查询的性能?