Hello,
Env: DB2 V8 LUW FP16 running Linux
create Table X (machine_id varchar(24) not null, ctime timestamp not
null);
create index iFoo on X (MACHINE_ID, CTIME) allow reverse scans;
alter table X add primary key (MACHINE_ID, CTIME);
Our C++ application inserts data into a table X using CLI array insert
with very good throughput.
On an hourly basis, another application (running on a different
server) reads the last 'hour':
select * from T where MACHINE_ID = ? and ctime between current
timestamp - 1 hour and current timestamp for read only;
After that, it starts a delete loop:
while (SQLCODE <100 )
do
delete from (select 1 from T where MACHINE_ID = ? and CTIME between
current timestamp - 1 hour and current timestamp fetch first 2000 rows
only) as B
done
The deletes have severe impact on my insert rate/throughput. I can see
number 3 times slower, or even worse. There are absolutely *NO* lock-
waits.
Question: Should I expect this performance degradation or am I missing
something ? Maybe there is a better technique to delete data.
Any thoughts ?
Thanks in advance,
Env: DB2 V8 LUW FP16 running Linux
create Table X (machine_id varchar(24) not null, ctime timestamp not
null);
create index iFoo on X (MACHINE_ID, CTIME) allow reverse scans;
alter table X add primary key (MACHINE_ID, CTIME);
Our C++ application inserts data into a table X using CLI array insert
with very good throughput.
On an hourly basis, another application (running on a different
server) reads the last 'hour':
select * from T where MACHINE_ID = ? and ctime between current
timestamp - 1 hour and current timestamp for read only;
After that, it starts a delete loop:
while (SQLCODE <100 )
do
delete from (select 1 from T where MACHINE_ID = ? and CTIME between
current timestamp - 1 hour and current timestamp fetch first 2000 rows
only) as B
done
The deletes have severe impact on my insert rate/throughput. I can see
number 3 times slower, or even worse. There are absolutely *NO* lock-
waits.
Question: Should I expect this performance degradation or am I missing
something ? Maybe there is a better technique to delete data.
Any thoughts ?
Thanks in advance,
Comment