Use query restrictions

I create my own clone http://statoverflow.com/sandbox (using free 10K controls for Telerik users ). I have evidence of the availability of a concept that I can use locally, but before I open it to others, I need to block it a bit more. I am currently running everything through a stored procedure that looks something like this:

CREATE PROCEDURE WebQuery 
    @QueryText nvarchar(1000)
AS
BEGIN
    -- no writes, so no need to lock on select
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED 

    -- throttles
    SET ROWCOUNT 500 
    SET QUERY_GOVERNOR_COST_LIMIT 500

    exec (@QueryText)

END

I need to do two more things:

  • Replace QUERY_GOVERNOR_COST_LIMITwith the actual, and not with the estimated timeout, so the request will not work longer than 2 minutes.
  • "SET ROWCOUNT 50000"; , , - () SET exec.

?

+3
3

Ad-Hoc SQL? SET, . , , lexx/yacc flex/bison ( CLR) SET. SET @variable=value, SET...

EXECUTE AS, , , REVERT :) , , EXECUTE AS.

, , - . MAX_QUEUE_READERS, . . , . , , , .

+3

, , SELECT? , , CTE DECLARE? 1000 - , , .

, , SELECT TOP 500 FROM (

a). , , . , SELECT SELECT TOP 500.

, ORDER BY -, .

0

Source: https://habr.com/ru/post/1717993/


All Articles