sql - Is it possible to reject excessively large queries on specific views? -
i'm working ms-sql server, , have several views have potential return enormous amounts of processed data, enough spike our servers 100% resource usage 30 minutes straight single query (if queried irresponsibly).
there absolutely no business case in such huge amounts of data need returned these views, we'd lock down make sure nobody can dos our sql servers (intentionally or otherwise) querying these particular views without proper where
clauses etc.
is possible, via triggers or method, check where
clause etc. , confirm whether given query "safe" execute (based on thresholds determine), , reject query if doesn't meet our guidelines?
or can configure server reject given execution plans based on estimated time-to-completion etc.?
one potential way reduce overall cost of queries coming group of people use resource governor. can throttle how cpu and/or memory used particular user/group. effective if have "wild west" kind of environment users submit bad queries eat resources alive. see here.
another thing consider set maxdop (max degree of parallelism) prevent single query taking of available cpu threads. is, if maxdop 1, query can take 2 cpu threads process. useful prevent large query letting smaller quick ones processing. see here.
Comments
Post a Comment