Have you ever wondered how much memory to assign your SQL Server instance?
Here’s a script to do it for you. If you want to understand how it works, read on!
This is based on an algorithm that Jonathan Kehayias wrote in his book, Troubleshooting SQL Server: A Guide for the Accidental DBA, and repeated in his blog post, How much memory does my SQL Server actually need?.
In broad strokes, you should give the operating system the following (quoted from the blog post):
- 1 GB of RAM for the OS
- plus 1 GB for each 4 GB of RAM installed from 4 – 16 GB
- plus 1 GB for every 8 GB RAM installed above 16 GB RAM
Whatever is left over, can go to your dedicated SQL Server instance. If you’re running anything else on the server, you will need to adjust the Max Server Memory downwards accordingly.
Keep in mind that some internal and peripheral devices may have additional memory requirements (see the blog post above).
Please feel free to use and share this link.
RAM Installed in System | Max Server Memory |
4 GB | 2 GB |
8 GB | 5 GB |
12 GB | 8 GB |
16 GB | 11 GB |
20 GB | 14 GB |
24 GB | 18 GB |
28 GB | 21 GB |
32 GB | 25 GB |
36 GB | 28 GB |
40 GB | 32 GB |
44 GB | 35 GB |
48 GB | 39 GB |
52 GB | 42 GB |
56 GB | 46 GB |
60 GB | 49 GB |
64 GB** | 53 GB |
68 GB | 56 GB |
72 GB | 60 GB |
76 GB | 63 GB |
80 GB | 67 GB |
84 GB | 70 GB |
88 GB | 74 GB |
92 GB | 77 GB |
96 GB | 81 GB |
100 GB | 84 GB |
104 GB | 88 GB |
108 GB | 91 GB |
112 GB | 95 GB |
116 GB | 98 GB |
120 GB | 102 GB |
124 GB | 105 GB |
128 GB** | 109 GB |
132 GB | 112 GB |
136 GB | 116 GB |
140 GB | 119 GB |
144 GB | 123 GB |
148 GB | 126 GB |
152 GB | 130 GB |
156 GB | 133 GB |
160 GB | 137 GB |
164 GB | 140 GB |
168 GB | 144 GB |
172 GB | 147 GB |
176 GB | 151 GB |
180 GB | 154 GB |
184 GB | 158 GB |
188 GB | 161 GB |
192 GB | 165 GB |
196 GB | 168 GB |
200 GB | 172 GB |
204 GB | 175 GB |
208 GB | 179 GB |
212 GB | 182 GB |
216 GB | 186 GB |
220 GB | 189 GB |
224 GB | 193 GB |
228 GB | 196 GB |
232 GB | 200 GB |
236 GB | 203 GB |
240 GB | 207 GB |
244 GB | 210 GB |
248 GB | 214 GB |
252 GB | 217 GB |
256 GB | 221 GB |
260 GB | 224 GB |
264 GB | 228 GB |
268 GB | 231 GB |
272 GB | 235 GB |
276 GB | 238 GB |
280 GB | 242 GB |
284 GB | 245 GB |
288 GB | 249 GB |
292 GB | 252 GB |
296 GB | 256 GB |
300 GB | 259 GB |
304 GB | 263 GB |
308 GB | 266 GB |
312 GB | 270 GB |
316 GB | 273 GB |
320 GB | 277 GB |
324 GB | 280 GB |
328 GB | 284 GB |
332 GB | 287 GB |
336 GB | 291 GB |
340 GB | 294 GB |
344 GB | 298 GB |
348 GB | 301 GB |
352 GB | 305 GB |
356 GB | 308 GB |
360 GB | 312 GB |
364 GB | 315 GB |
368 GB | 319 GB |
372 GB | 322 GB |
376 GB | 326 GB |
380 GB | 329 GB |
384 GB | 333 GB |
388 GB | 336 GB |
392 GB | 340 GB |
396 GB | 343 GB |
400 GB | 347 GB |
404 GB | 350 GB |
408 GB | 354 GB |
412 GB | 357 GB |
416 GB | 361 GB |
420 GB | 364 GB |
424 GB | 368 GB |
428 GB | 371 GB |
432 GB | 375 GB |
436 GB | 378 GB |
440 GB | 382 GB |
444 GB | 385 GB |
448 GB | 389 GB |
452 GB | 392 GB |
456 GB | 396 GB |
460 GB | 399 GB |
464 GB | 403 GB |
468 GB | 406 GB |
472 GB | 410 GB |
476 GB | 413 GB |
480 GB | 417 GB |
484 GB | 420 GB |
488 GB | 424 GB |
492 GB | 427 GB |
496 GB | 431 GB |
500 GB | 434 GB |
504 GB | 438 GB |
508 GB | 441 GB |
512 GB | 445 GB |
516 GB | 448 GB |
520 GB | 452 GB |
524 GB | 455 GB |
528 GB | 459 GB |
532 GB | 462 GB |
536 GB | 466 GB |
540 GB | 469 GB |
544 GB | 473 GB |
548 GB | 476 GB |
552 GB | 480 GB |
556 GB | 483 GB |
560 GB | 487 GB |
564 GB | 490 GB |
568 GB | 494 GB |
572 GB | 497 GB |
576 GB | 501 GB |
580 GB | 504 GB |
584 GB | 508 GB |
588 GB | 511 GB |
592 GB | 515 GB |
596 GB | 518 GB |
600 GB | 522 GB |
604 GB | 525 GB |
608 GB | 529 GB |
612 GB | 532 GB |
616 GB | 536 GB |
620 GB | 539 GB |
624 GB | 543 GB |
628 GB | 546 GB |
632 GB | 550 GB |
636 GB | 553 GB |
640 GB | 557 GB |
644 GB | 560 GB |
648 GB | 564 GB |
652 GB | 567 GB |
656 GB | 571 GB |
660 GB | 574 GB |
664 GB | 578 GB |
668 GB | 581 GB |
672 GB | 585 GB |
676 GB | 588 GB |
680 GB | 592 GB |
684 GB | 595 GB |
688 GB | 599 GB |
692 GB | 602 GB |
696 GB | 606 GB |
700 GB | 609 GB |
704 GB | 613 GB |
708 GB | 616 GB |
712 GB | 620 GB |
716 GB | 623 GB |
720 GB | 627 GB |
724 GB | 630 GB |
728 GB | 634 GB |
732 GB | 637 GB |
736 GB | 641 GB |
740 GB | 644 GB |
744 GB | 648 GB |
748 GB | 651 GB |
752 GB | 655 GB |
756 GB | 658 GB |
760 GB | 662 GB |
764 GB | 665 GB |
768 GB | 669 GB |
772 GB | 672 GB |
776 GB | 676 GB |
780 GB | 679 GB |
784 GB | 683 GB |
788 GB | 686 GB |
792 GB | 690 GB |
796 GB | 693 GB |
800 GB | 697 GB |
804 GB | 700 GB |
808 GB | 704 GB |
812 GB | 707 GB |
816 GB | 711 GB |
820 GB | 714 GB |
824 GB | 718 GB |
828 GB | 721 GB |
832 GB | 725 GB |
836 GB | 728 GB |
840 GB | 732 GB |
844 GB | 735 GB |
848 GB | 739 GB |
852 GB | 742 GB |
856 GB | 746 GB |
860 GB | 749 GB |
864 GB | 753 GB |
868 GB | 756 GB |
872 GB | 760 GB |
876 GB | 763 GB |
880 GB | 767 GB |
884 GB | 770 GB |
888 GB | 774 GB |
892 GB | 777 GB |
896 GB | 781 GB |
900 GB | 784 GB |
904 GB | 788 GB |
908 GB | 791 GB |
912 GB | 795 GB |
916 GB | 798 GB |
920 GB | 802 GB |
924 GB | 805 GB |
928 GB | 809 GB |
932 GB | 812 GB |
936 GB | 816 GB |
940 GB | 819 GB |
944 GB | 823 GB |
948 GB | 826 GB |
952 GB | 830 GB |
956 GB | 833 GB |
960 GB | 837 GB |
964 GB | 840 GB |
968 GB | 844 GB |
972 GB | 847 GB |
976 GB | 851 GB |
980 GB | 854 GB |
984 GB | 858 GB |
988 GB | 861 GB |
992 GB | 865 GB |
996 GB | 868 GB |
1000 GB | 872 GB |
1004 GB | 875 GB |
1008 GB | 879 GB |
1012 GB | 882 GB |
1016 GB | 886 GB |
1020 GB | 889 GB |
1024 GB | 893 GB |
** Standard Edition supports a maximum of 64 GB RAM, for SQL Server 2012 and below. SQL Server 2014 Standard Edition and higher supports up to 128 GB RAM.