IT tutorials
 
Database
 

SQL Server 2012 : Configuration Options (part 3) - Memory-Configuration Properties

1/11/2014 8:33:43 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

3. Memory-Configuration Properties

SQL Server can either dynamically request memory from the operating system or consume a fixed amount of memory. You can configure these settings on the SQL Server Properties Memory tab, as shown in Figure 2, or from code by means of the sp_configure stored procedure.

Figure 2 Memory tab of Management Studio's SQL Server Properties dialog.

19.6

The memory-configuration properties, listed in Table 2, control how SQL Server uses and allocates memory.

Table 2 Memory-Configuration Properties

c19tnt002
Note
The configuration options set working set size, open objects, and locks are still present in the sp_configure stored procedure, but their functionality was removed in SQL Server 2008 and is unavailable in Microsoft SQL Server 2012. These options have no effect. Do not use these options in new development work because they may be removed in future SQL Server versions.

Dynamic Memory

If SQL Server is set to dynamically use memory, then SQL Server's memory can grow or be reduced as needed within the minimum and maximum constraints based on the physical memory available and the workload. SQL Server tries to maintain its requirement of 64MB and 128MB for the 32-bit and 64-bit versions respectively. The goal is to have enough memory available while avoiding Windows needing to swap pages from memory to the virtual-memory support file (pagefile.sys).

The minimum-memory property prohibits SQL Server from reducing memory below a certain point and hurting performance, but it does not guarantee that SQL Server will immediately allocate the minimum amount of memory at startup. The minimum simply means that when SQL Server memory has reached that point, it will not reduce memory below it.

The maximum-memory setting prevents SQL Server from growing to the point where it contends with the operating system, or other applications, for memory. If the maximum is set too low, then performance suffers.

Note
In SQL Server 2012, all memory allocations by SQL Server components will now observe the “max server memory” configuration option. In previous versions only the 8K allocations were limited by the “max server memory” configuration option. Allocations larger than 8K weren't constrained.

Multiple SQL Server instances do not cooperate when requiring memory. In servers with multiple instances, it's highly possible for two busy instances to contend for memory and for one to become memory-starved. Reducing the maximum-memory property for each instance can prevent this from happening.

From T-SQL code, the minimum- and maximum-memory properties are set by means of the sp_configure system stored procedure. It's an advanced option, so it can be changed only if the show advanced options property is on:

EXEC sp_configure ‘show advanced options', 1;
RECONFIGURE;
Note
show advanced options needs to be turned on only if it is not already turned on. After it is turned on, you can change the advanced options and then reset it to the default value of 0.

The following code sets the min-memory configuration to 1GB:

EXEC sp_configure ‘min server memory', 1024;
RECONFIGURE;

Result:

Configuration option ‘min server memory (MB)’ 
changed from 0 to 1024.
Run the RECONFIGURE statement to install.

The following code sets the max-memory configuration to 4GB:

EXEC sp_configure ‘max server memory', 4096;
RECONFIGURE;

Result:

Configuration option ‘max server memory (MB)’ 
changed from 2147483647 to 4096.
Run the RECONFIGURE statement to install.

Fixed Memory

Instead of dynamically consuming memory, you can configure SQL Server to request a fixed amount of memory from the operating system. To set a fixed amount of memory from code, set the minimum- and maximum-memory properties to the same value. The following code sets the SQL Server memory to a fixed memory of 6144MB.

EXEC sp_configure ‘show advanced options', 1; 
RECONFIGURE;
EXEC sp_configure ‘min server memory', 6144;
RECONFIGURE;
EXEC sp_configure ‘max server memory', 6144;
RECONFIGURE;

Although calculating memory cost, polling the environment, and requesting memory may seem as if they would require overhead, you aren't likely to see any performance gains from switching from dynamic to fixed memory. The primary purpose of using fixed memory is to configure a dedicated SQL Server computer to use a fixed amount of memory after the value is reached.

Minimum Query Memory

At times, the SQL Server team amazes me with the level of detailed control it passes to DBAs. SQL Server can allocate the required memory for each query as needed. The min memory per query option sets the minimum threshold for the memory (KB) used by each query. Although increasing this property to a value higher than the default 1MB may provide slightly better performance for some queries, there is no reason to override SQL Server automatic memory control and risk causing a memory shortage. If you insist on doing so, here's how to do it. The following code increases the minimum query memory to 2MB:

EXEC sp_configure ‘show advanced options', 1; 
RECONFIGURE;
EXEC sp_configure ‘min memory per query', 2048;
RECONFIGURE;

Query Wait

If the memory is unavailable to execute a large query, SQL Server waits for the estimated amount of time necessary to execute the query times 25 and then times out.

Usually you do not need to change the query wait option, but if you have a valid reason to change this option, you can either use Management Studio or T-SQL-code. In Management Studio, you can set the query wait option by entering the value in the query wait box on the Server Properties Advanced tab .

The following code specifies that every query either starts executing within 20 seconds or times out.

EXEC sp_configure ‘show advanced options', 1; 
RECONFIGURE;
EXEC sp_configure ‘query wait', 20;
RECONFIGURE;

To revert to the default wait time of the estimated execution time times 25, you must specify the query wait time as -1.

AWE-Enabled

On 32-bit operation systems, SQL Server is normally restricted to the standard 2GB physical-memory limit (or 3GB if /3GB switch is used in boot.ini). On 64-bit operation systems, the awe enabled option is ignored, even though it is present in the sp_configure stored procedure.

SQL Server x86 Standard, Enterprise, and Developer Editions, when running on Windows Server 2003 or 2008 Enterprise or Datacenter Editions, can use up to 64GB of physical memory by configuring SQL Server to address the Address Windowing Extensions (AWE) API. The AWE-enabled property turns on AWE memory addressing within SQL Server.

EXEC sp_configure ‘show advanced options', 1; 
RECONFIGURE;
EXEC sp_configure ‘awe enabled', 1;
RECONFIGURE;
Note
In SQL Server 2012, Address Windowing Extensions (AWE) has been deprecated.

Note
The Windows privilege LOCK PAGES IN MEMORY must be granted to the SQL Server service account before enabling awe. A system administrator can use the Windows Group Policy tool (gpedit.msc) to enable this privilege for the SQL Server service account.

Note
The SQL Server instance must be restarted for the awe enabled option to take effect. If the awe enabled option is configured successfully, then the SQL Server Error Log includes an Address Windowing Extensions Enabled message when the SQL Server restarts.

Index Create Memory

The amount of memory SQL Server uses to perform sorts when creating an index is generally self-configuring. However, you can control it by using sp_configure to hard-code a certain memory footprint (KB) for index creation. For example, the following code sets the memory used to create an index to 8MB:

EXEC sp_configure ‘show advanced options', 1; 
RECONFIGURE;
EXEC sp_configure ‘index create memory', 8096;
RECONFIGURE;
Note
Index create memory option is self-configuring and usually works without additional adjustments. The option to modify index creation memory is an advanced option and should only be changed by an experienced database administrator or certified SQL Server technician.
 
Others
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us