|Pivotal Greenplum (GPDB)||4.3.x|
The purpose of this document is give you a quick insight into how Resource Queue (RQ) works.
Resource Queue (RQ) Further Explained
- Any user with superuser privilege does not have RQ restrictions.
- The amount of memory allowed for a session usage is the higher value between the statement_mem and RQ memory divided by RQ slots.
- Based on cost, we can categorize queries into two types where RQ is concerned, small queries and big queries.
1. Small Query (Cost Of Query < min_cost)
- If it is a small query, then it is not restricted by RQ attributes, and so the optimizer and GPDB engine will start executing immediately.
- The idea of the small query is to not restrict queries below a certain cost and execute them fast enough. Consider more of OLTP query type queries as examples of small queries.
- This means that the min_cost value needs to be set appropriately low enough and not very high, otherwise many big queries will start going in the system without restriction.
- Any resource used by a small query does not count against RQ limits. For example: active_statements and the memory_limit is not counted against the RQ limit.
2. Big Query (Cost of Query > min_cost)
- They have to adhere to all the attributes of the RQ that is set. At that time, all the parameters except "Priority" are considered first for query submission and then execution.
- The "Priority" attribute will be considered for the query being executed in the engine and the highest priority query will be given more resources. This means that the priority attribute is used for competing against queries of different RQs .
- Reporting or warehousing queries are examples of big queries.