Reputation: 591
How to limit amount of queries which user can execute per day on Amazon Redshift ? Or if it possible to limit CPU time of the cluster to some amount?
Upvotes: 2
Views: 2210
Reputation: 270029
No, it is not possible to limit users by the number of queries nor the amount of CPU time.
Presumably, you are asking this either because a user is hogging resources, or due to a desire to limit rampant tasks, such as a Dashboard making too many requests and therefore impacting other users.
A couple of options:
Write your own limiter
The STL_QUERY
system table contains a list of all queries processed by Redshift, including a User ID, Start Time and End Time.
You could write an application that queries this table to determine whether users have exceeded a number of queries or total CPU time. The application could then disable the user or reduce their permissions.
Use Workload Management
Amazon Redshift can define multiple query queues for handling simultaneous requests. Each queue contains a number of slots. Queries run within a slot.
Users can be assigned to specific query queues such that one user's queries do not interfere with another user's queries.
For example, the Dashboard user could all be assigned to one queue while interactive users could be assigned to a different queue. If the dashboards make too many simultaneous queries, they will queue up for available capacity without impacting the interactive users.
However, this only limits the number of simultaneous queries and the amount of RAM allocated. It will not limit based upon the number of queries nor total CPU used.
Upvotes: 4
Reputation: 538
You can use Query Queues in Redshift to limit the impact of one set of users queries on other users queries. It seems to be divided by memory but it should be able to do what you want.
Further Reading: Defining Query Queues
Upvotes: 1