- 论坛徽章:
- 0
|
Select sffid,receSeriNo
From sf03
Where 1=1
And currency Matches 'CNY'
and receserino[1]='R'
And receSeriNo Matches 'R6542240120070800157'
这个sql提取很快,run完马上就出来了。
Select sffid,receSeriNo
From sf03
Where 1=1
And currency Matches 'CNY'
and receserino[1]='R'
And receSeriNo Matches 'R6542240120070800157'
And receserino[1]='R'
这个sql却很慢,至少要等1分钟。
为什么?
sf03里有283万条数据,具体表的主健和索引是这样的:
primary key (receserino) constraint "sff".sf03_p
);
revoke all on "sff".sf03 from "public";
create index "sff".sf03i1 on "sff".sf03 (dealno,suffixno) using
btree ;
create index "sff".sf03i2 on "sff".sf03 (deskdate,ksdm) using
btree ;
create index "sff".sf03i3 on "sff".sf03 (paydate,ksdm) using btree
;
create index "sff".sf03i4 on "sff".sf03 (receiptno,versionno,receiptkind)
using btree ;
create index "sff".sf03i6 on "sff".sf03 (ksdm,procdate) using
btree ;
create unique index "sff".sf03iid on "sff".sf03 (sffid) using
btree ;
为什么加了条件就慢呢?统计更新也做了 |
|