PokerTracker 3 uses the PostgreSQL database server to store your hands and information/statistics about your hands. All databases are extremely file intensive as data is constantly being write and read from your hard drive. Hard drives are very slow and take a long time to retrieve data. We can minimize the number of times PostgreSQL is required to read from your hard drive by storing pieces of your database into memory (RAM) which is very fast. By default, PostgreSQL is configured to use a very small amount of memory which is far from optimum. This tutorial will tweak the PostgreSQL configurations so that more memory is used and in turn PokerTracker 3/PostgreSQL performance is increased.
This method requires PostgreSQL 8.3.x which is the version of PostgreSQL currently packaged with PokerTracker 3. You can determine your version of PostgreSQL by going Start->Run->Programs->PostgreSQL->Command Prompt then typing the following at the command prompt:
- Code: Select all
- Go Start->Programs->PostgreSQL 8.3 and look for "Application Stack Builder". If listed, please jump to step 10.
- Uninstall PostgreSQL via the Windows control panel (your data will be preserved)
- (Vista users only) Make sure that User Account Control is disabled.
- Start->Run, 'cmd' -> OK. At the command prompt type "net user postgres /delete" (no quotes) and hit enter.
- Download the latest version of PostgreSQL 8.3.x from the PostgreSQL website. (Choose the latest version -> select 'win32' -> select 'postgresql-8.3.x.zip' -> click either http or ftp under your country's flag)
- After download has completed, double click the file to open then extract the contents of the downloaded zip file.
- Double click and run 'postgresql-8.3.msi' to manually re-install PostgreSQL 8.3.x
- When you get to the screen to "Initialize your Cluster", uncheck the box to skip this step. (This is not needed since your data directory is already configured and in tact from the previous installation)
- At the end of the installation...
- Launch the "Application Stack Builder"
- Select your PostgreSQL Database Server and click 'Next'.
- Expand "AddOns" and check "EnterpriseDB Tuning Wizard
- Download the tuning wizard by selecting your country and continuing
- Continue through the end of installation and ...
- Launch the EnterpriseDB Tuning Wizard
- Select your PostgreSQL Database server and click 'Next'
- Under "Server Utilization" select "Mixed" and click 'Next'.
- Continue through the installation of the tuning wizard
This method should only be performed by advanced computer users who are familiar with PostgreSQL configurations.
- Open 'My Computer' and browse to your C:\Program Files\PostgreSQL\8.x\data directory and make a copy of "postgresql.con" as a backup.
- Open the original postgresql.conf file in Notepad or go Start->Programs->PostgreSQL->Configuration Files->Edit postgresql.conf
- Find the following configurations:
- "shared_buffers = xMB" and set this number equal to about 1/4 of your total memory. That is, if you have 2GB of RAM, set this to 512MB.
- "work_mem = xMB" and set this value equal to about 1/64 of your total memory. That is, if you have 2GB of RAM, set this to 32MB.
- "maintenance_work_mem = xMB" and set this value equal to about 1/16 of your total memory. That is, if you have 2GB of RAM, set this to 128MB.
Note: work_mem and maintentance_work_mem by default are commented out in the configuration file (e.g. has a # in front of them), so make sure to remove those symbols to put the changes into effect.
- File->Save to save the changes
- Go Start->Programs->PostgreSQL->Reload Configuraitons for the changes to take effect.
The exact configuration values are more of an art than a science. While these values will work for most users, it could potentially cause problems for other users. If you are experiencing issues, lower the values or follow the "Recommend Method" above.
If you receive an error message saying that the file can't be written when you try to save the configuration file after having made these changes, make sure that you're running as administrator. To do that, go Start->Programs->PostgreSQL->Configuration Files and now right-click on "Edit postgresql.conf" and choose "Run as administrator".
If you have PostgreSQL running on a Linux machine, you may receive the following error message when changing these settings:
- Code: Select all
EDT DETAIL: Will not verify client certificates.
EDT FATAL: could not create shared memory segment: Invalid argument
EDT DETAIL: Failed system call was shmget(key=5432001, size=549330944, 03600).
If you get this message, you need to edit /etc/sysctl.conf and add the following line:
kernel.shmmax = N
Where you need to replace N with a number larger than the one you just set for "shared_buffers" in the postgresql.conf. Now, this setting uses bytes and not megabytes. If you set shared_buffers to 512 MB, a working value for the kernel.shmmax would be 550000000. You can also see the "size=X" mentioned in the error message above, this is the value that you need to exceed. After having done this change you need to run sysctl -p to load the settings.