share table和share streamTable有什么区别

共享的streamTable可以实现订阅的功能,但是共享的普通table不可以。

既然如此,为什么不直接用共享的streamTable替代普通的table呢?

请先 登录 后评论

1 个回答

Feng Gao

首先,共享表都可以被其他的session使用,对于共享流表,可以被订阅,但是共享的普通内存表是不可以的。

但是共享的流表是不可以删除、修改其中的数据的,共享的普通内存表是可以的,代码验证如下:

share table(1 2 3 as id, 4 5 6 as value) as table1;
go;
update table1 set id = 7 ; // 成功
delete from table1;  // 成功 

share streamTable(1 2 3 as id, 4 5 6 as value) as table2;
go;
update table2 set id = 7 ; // update table2 set id = 7 => The table is not allowed to update.
delete from table2; // delete from table2 => It is not allowed to delete rows from the specified table.
请先 登录 后评论
  • 2 关注
  • 0 收藏,815 浏览
  • dongmange 提出于 2022-11-03 18:08