CHAPTER 26 POSTGRESQL (Cedant web hosting) ADMINISTRATION to 3MB of
Tuesday, March 11th, 2008CHAPTER 26 POSTGRESQL ADMINISTRATION to 3MB of memory to be used. This might not sound like much, but on a server with a small amount of RAM (say 256MB) that has to handle a large number of connections (say 100), you can see how this could easily exhaust all of the available RAM on the system. This setting can be set per connection, though, so one trick you can use is to set the value higher for specific connections that might need to run more intensive queries, like a reporting interface. To change this setting on an individual connection, you would use the SET command: SET work_mem = 2028; maintenance_work_mem This setting, also known as vacuum_mem prior to version 8, is similar to the work_mem setting but is used for system tasks, including vacuuming and creating new indexes. Its value is a number equivalent to 1KB; the default value is 16,384KB (16MB) as of 8.0, and 8,192KB (8MB) in prior versions. Since these operations are not generally run in concurrent fashion, it is often safe to set this value even higher if you work with larger tables. This value can also be set per session. max_prepared_transactions This setting, new in PostgreSQL 8.1, controls the number of transactions that can be simultaneously prepared for two-phase commit. The default value is five, but if you are not using twophase commit, then you can effectively set this to 0. While this won t result in large performance increases, since use of two-phase commit within PHP is almost nonexistent, it doesn t hurt to turn it off. max_fsm_relations This setting sets the maximum number of relations (tables and indexes) that will be tracked within the freespace map. Its value is a number equal to one relation, with a default setting of 1,000. For most people, this amount is enough, but setting this too low can cause serious performance issues, so it is best to occasionally verify you have set it appropriately. You can determine the number of relations that are needed by using the following query: SELECT count(*) FROM pg_class WHERE relkind IN (’r',’t'); Since this setting is set cluster-wide, you need to run it once on each database within the cluster and add the results together to get the proper level needed. This value requires a full restart of PostgreSQL for any changes to take effect. max_fsm_pages The max_fsm_pages setting controls the maximum number of disk pages that will be tracked within the free space map. It takes a value equal to one page, with a minimum value equal to 16 max_fsm_relations, and a default setting of 20,000. This value is critical in helping to manage the underlying disk pages used, and should be set high enough to handle all pages that are part of an update or deletion between vacuums. The easiest way to determine an appropriate level is to periodically run VACUUM VERBOSE on the database running under a production-level load, which will produce a summary of the number of disk pages modified, and a note regarding what this setting should be set to if it is too low. Also be aware that this setting is set cluster-wide, so if you have multiple databases in
You want to have a cheap webhost for your apache application, then check apache web hosting services.