Allocate memory to SELECT statement in sql server 2005

  • Hi all,

    I have a SELECT query. How can I allocate part of memory to this SELECT statement.

    Kindly reply soon.

    Thanks in advance.

  • SQL manages memory for queries itself. What are you trying to do here that you want memory allocated?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • beejug1983 (1/11/2011)


    how can I allocate part of memory to this SELECT statement

    I don;t think there is any way in sql server in any version\Edtion which will allow to allocate or define a quota for a query.

    my question is why do you want such thing to happen?

    sql server has a reserved memory space known as buffer cache which is divided majorily into 2 parts

    data cache and procedure cache .

    and how much and how less depends on the configurtion of minimun and maximun server memory setting under sp_configure.

    pls. eloborate your requirement a bit more clearly...

  • Actually it was interview question.

  • Actually it was interview question.

  • Then the answer is simple - you can't.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It can be done for a particular login using resource governer but not for a query or a SP.What you do basically is create resource pool and assign that resource pool to that particular login.

    So any query or SP that is run with that particular login will only have memory resources defined in resource governer .

    --------------------------------------------------------------------------------------------------
    I am just an another naive wannabe DBA trying to learn SQL Server

  • Sachin Nandanwar (1/12/2011)


    It can be done for a particular login using resource governer but not for a query or a SP.What you do basically is create resource pool and assign that resource pool to that particular login.

    So any query or SP that is run with that particular login will only have memory resources defined in resource governer .

    Just remember that Resource Governor is new to SQL Server 2008 and this is a 2005 question.

    Maybe it is time to upgrade? 🙂

    And this is exactly the kind of thing it was made for

    http://technet.microsoft.com/en-us/library/bb895232.aspx

    And only CPU and memory can be governed, by a percentage of the total, with a minimum and maximum for each workload definition. This is definitely a feature worth upgrading to 2008 for.

    Peter Trast
    Microsoft Certified ...(insert many literal strings here)
    Microsoft Design Architect with Alexander Open Systems

  • You can't allocate memory at the individual query level.

    Thank You,

    Best Regards,

    SQLBuddy

  • sqlbuddy123 (1/13/2011)


    You can't allocate memory at the individual query level.

    Thank You,

    Best Regards,

    SQLBuddy

    You are correct that there is no classifier for a t-sql DEFINITION of an adhoc query, but I COULD govern a specific query if it has properties that can be defined by a classifier function, such as a LOGIN_PROPERTY, SUSER_NAME, etc, and it was the ONLY query that ever used this classifier property. Then you could allocate memory for a specific query because the classifier property is used only by that query. Splitting hairs, I know, but still true. So you would create a specific login that was only used to run that one query.

    Cannot is too broad. There are often many ways to do things which "cannot" be done. 🙂

    "Those who say it cannot be done shouldn't interrupt the people doing it" --

    Ancient Chinese Proverb... supposedly 🙂

    Peter Trast
    Microsoft Certified ...(insert many literal strings here)
    Microsoft Design Architect with Alexander Open Systems

  • Peter Trast (1/13/2011)[hr

    Just remember that Resource Governor is new to SQL Server 2008 and this is a 2005 question.

    Maybe it is time to upgrade? 🙂

    And this is exactly the kind of thing it was made for

    http://technet.microsoft.com/en-us/library/bb895232.aspx

    And only CPU and memory can be governed, by a percentage of the total, with a minimum and maximum for each workload definition. This is definitely a feature worth upgrading to 2008 for.

    And hence the Answer. I was referring to SQL 2005 as this is SQL 2005 forum

    Thank You,

    Best Regards,

    SQLbuddy

  • Just as a side note:

    Resource Governor is available only on the Enterprise, Developer, and Evaluation editions of SQL Server (2008 and up).



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Just remember that Resource Governor is new to SQL Server 2008 and this is a 2005 question.

    Yeah.That's true. How did I miss that ?

    --------------------------------------------------------------------------------------------------
    I am just an another naive wannabe DBA trying to learn SQL Server

  • sqlbuddy123 (1/13/2011)


    Peter Trast (1/13/2011)[hr

    Just remember that Resource Governor is new to SQL Server 2008 and this is a 2005 question.

    Maybe it is time to upgrade? 🙂

    And this is exactly the kind of thing it was made for

    http://technet.microsoft.com/en-us/library/bb895232.aspx

    And only CPU and memory can be governed, by a percentage of the total, with a minimum and maximum for each workload definition. This is definitely a feature worth upgrading to 2008 for.

    And hence the Answer. I was referring to SQL 2005 as this is SQL 2005 forum

    Thank You,

    Best Regards,

    SQLbuddy

    Agreed! In SQL Server 2005, it cannot be done. Hence the recommendation to upgrade (and no longer need this forum) 🙂

    Salutations!

    Peter

    Peter Trast
    Microsoft Certified ...(insert many literal strings here)
    Microsoft Design Architect with Alexander Open Systems

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply