@@ -78,8 +78,9 @@ create or replace type body ut_output_table_buffer is
7878 end;
7979
8080 overriding member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural := null) return ut_output_data_rows pipelined is
81+ type t_rowid_tab is table of urowid;
82+ l_message_rowids t_rowid_tab;
8183 l_buffer_data ut_output_data_rows;
82- l_message_ids ut_integer_list;
8384 l_finished_flags ut_integer_list;
8485 l_already_waited_for number(10,2) := 0;
8586 l_finished boolean := false;
@@ -90,14 +91,14 @@ create or replace type body ut_output_table_buffer is
9091 lc_long_sleep_time constant number(1) := 1; --sleep for 1 s when waiting long
9192 lc_long_wait_time constant number(1) := 1; --waiting more than 1 sec
9293 l_sleep_time number(2,1) := lc_short_sleep_time;
93- lc_bulk_limit constant integer := 100 ;
94+ lc_bulk_limit constant integer := 3000 ;
9495
95- procedure remove_read_data(a_message_ids ut_integer_list ) is
96+ procedure remove_read_data(a_message_rowids t_rowid_tab ) is
9697 pragma autonomous_transaction;
9798 begin
98- delete from ut_output_buffer_tmp a
99- where a.output_id = self.output_id
100- and a.message_id in (select column_value from table(a_message_ids) );
99+ forall i in 1 .. a_message_rowids.count
100+ delete from ut_output_buffer_tmp a
101+ where rowid = a_message_rowids(i );
101102 commit;
102103 end;
103104
@@ -112,13 +113,13 @@ create or replace type body ut_output_table_buffer is
112113 begin
113114 while not l_finished loop
114115 with ordered_buffer as (
115- select a.message_id , ut_output_data_row(a.text, a.item_type), is_finished
116+ select a.rowid , ut_output_data_row(a.text, a.item_type), is_finished
116117 from ut_output_buffer_tmp a
117118 where a.output_id = self.output_id
118119 order by a.message_id
119120 )
120121 select b.*
121- bulk collect into l_message_ids , l_buffer_data, l_finished_flags
122+ bulk collect into l_message_rowids , l_buffer_data, l_finished_flags
122123 from ordered_buffer b
123124 where rownum <= lc_bulk_limit;
124125
@@ -147,7 +148,7 @@ create or replace type body ut_output_table_buffer is
147148 exit;
148149 end if;
149150 end loop;
150- remove_read_data(l_message_ids );
151+ remove_read_data(l_message_rowids );
151152 end if;
152153 if l_finished or l_already_waited_for >= l_wait_for then
153154 remove_buffer_info();
0 commit comments