Improve select statement with locking clause
With GDD enabled, and under some simple cases (refer the commit 6ebce733 and the function checkCanOptSelectLockingClause for details), we might also do some optimizations for the select statement with locking clause and limit clause. Greenplum generates two-stage-merge sort or limit plan to implement sort or limit and we can only lock tuples on segments. We prefer locking more tuples on segments rather than locking the whole table. Without the whole table lock, performance for OLTP should be improved. Also, after lockrows data cannot be assumed in order, but we do merge gather after lockrows. It is reasonable because even for postgres: `select * from t order by c for update` cannot guarantee result's order.
Showing
想要评论请 注册 或 登录