Improving processing speed
shinyaaa opened this issue · comments
I think the current source code is not efficient.
First, supautils need to execute two main logics which are look_for_reserved_membership and look_for_reserved_role, and in each of them supautils have to check check utility_stmt->type. However, CREATE ROLE and GRANT are used very infrequently compared to BEGIN and COMMIT. Therefore, I think it is more efficient to check utility_stmt->type and then execute the main logic.
Second, there is a process to convert GUC to List before entering the two main logics. This is best if it can be implemented with check_hook or assign_hook as pointed out in #14. However, since it is difficult to implement, I think it would be better to change it so that it is executed only when CREATE ROLE or GRANT is executed.
The concrete structure is as follows:
- Check valid transaction
- Check superuser
- Check utility_stmt->type
- In case of CREATE ROLE or GRANT, convert GUC to List and execute the main logic
I am planning to issue a PR if we can reach a consensus. What do you think?
Therefore, I think it is more efficient to check utility_stmt->type and then execute the main logic.
Yes, I guess we could have a conditional that checks for T_GrantRoleStmt, T_CreateRoleStmt, etc.
Second, there is a process to convert GUC to List before entering the two main logics. However, since it is difficult to implement, I think it would be better to change it so that it is executed only when CREATE ROLE or GRANT is executed.
Also agree. Maybe we can get the GUC->list logic inside the look_for_* functions.
I am planning to issue a PR if we can reach a consensus. What do you think?
Fully agree. Go ahead!
Fixed in #20.