通过ec程序,第一次创建临时表,查询临时表,非常慢。等到第二次执行的时候就非常快。
score--->数据量在360万左右
info columns for score
id serial
stuid char(11)
cid char(11)
score int
grade char(11)
comments char(110)
desc char(1)
date date
select * from score where id <70000 into temp scoretmp with no log;
select * from scoretmp a where exists (
select * from score where a.stuid = stuid and cid<1000);
time dbaccess db 1.sql
持续时间约为2min
第二次的时候 2s
重启数据库后第一次又是2min
通过不同的环境测试,都是第一次很慢,第二次就非常快
现在考虑是 第一次执行后数据被缓存到BUFFER POOL 中,所以第二次过来执行直接去BUFFER POOL 中读数据,
可是如何优化第一次执行的时间呢?
收起