| 272 | | Historically, the initial PostgreSQL configuration was designed to support older flavors of UNIX where allocating large amounts of memory wasn't necessarily possible. The result was that its use of memory for caching results was, by default, very pessimistic. On modern systems that have lots of memory available, this severely hinders untuned PostgreSQL performance. |
|---|
| 273 | | |
|---|
| 274 | | The defaults have gotten much less pessimistic in recent releases. System configuration is now examined at database initialization time and more memory allocated if it is possible to do so. As a result, the untuned default configurations on recent PostgreSQL versions perform significantly better than older versions. In addition, changes in cache management in versions 8.1 and 8.2 allow even modest amounts of cache to be used more effectively than they used to be. |
|---|
| 275 | | |
|---|
| 276 | | The primary tunable for both database systems works similarly, by allocating a block of shared memory dedicated to the database. MySQL tunes this with key_buffer_size when using MyISAM, and with innodb_buffer_pool_size when using InnoDB (note that you still need some MyISAM space for system tables even when InnoDB is the main storage engine for regular tables). PostgreSQL sizes its main memory space with shared_buffers. |
|---|
| 277 | | |
|---|
| 278 | | The MySQL key_buffer_size defaults to using 8MB of memory. Earlier PostgreSQL configurations would also allocate 8MB of memory for the shared_buffers cache if possible. On a server like a current generation Linux system, it's expected the recent PostgreSQL releases would set shared_buffers to at least 24MB by default when the database cluster is created. |
|---|
| 279 | | |
|---|
| 280 | | It is still worthwhile to go through the configuration files to tune them to match the available memory on a database server, as all these defaults are dramatically undersized compared to the amount of RAM in current systems. For a modern dedicated server, the rule of thumb for both PostgreSQL and MySQL is to size the dedicated memory to at least 1/4 of the total RAM in the machine, perhaps increasing to as much of 1/2 of RAM on the high side of normal. It's not out of the question to push this percentage even higher when using systems with very large amounts of RAM; MySQL InnoDB guidelines suggest even 80% isn't unreasonable. Performance comparisons using the defaults with either database are completely unrealistic of how a real system would be configured. Initial guidelines in this area can be found at 5-Minute Introduction to PostgreSQL Performance, Optimizing the mysqld variables and Optimizing the MySQL Server. |
|---|
| 281 | | Benchmarks |
|---|
| | 272 | // Historically, the initial PostgreSQL configuration was designed to support older flavors of UNIX where allocating |
|---|
| | 273 | // large amounts of memory wasn't necessarily possible. The result was that its use of memory for caching results was, |
|---|
| | 274 | // by default, very pessimistic. On modern systems that have lots of memory available, this severely hinders untuned |
|---|
| | 275 | // PostgreSQL performance. |
|---|
| | 276 | Historiquement, la configuration initiale de PostgreSQL était dimensionnée pour supporter les plus vieilles variantes |
|---|
| | 277 | d'UNIX où l'allocation de grande quantité de mémoire n'était pas nécessairement possible. Le résultat fût que son |
|---|
| | 278 | utilisation de la mémoire cache pour les résultats était, par défaut, très pessimiste. Sur les systèmes modernes qui |
|---|
| | 279 | possèdent beaucoup de mémoire libre, cela handicap fortement les performances d'un PostgreSQL non configuré. |
|---|
| | 280 | |
|---|
| | 281 | // The defaults have gotten much less pessimistic in recent releases. System configuration is now examined at database |
|---|
| | 282 | // initialization time and more memory allocated if it is possible to do so. As a result, the untuned default |
|---|
| | 283 | // configurations on recent PostgreSQL versions perform significantly better than older versions. In addition, changes |
|---|
| | 284 | // in cache management in versions 8.1 and 8.2 allow even modest amounts of cache to be used more effectively than |
|---|
| | 285 | // they used to be. |
|---|
| | 286 | Les valeurs par défaut sont beaucoup moins pessimistes dans les versions récentes. Désormais la configuration système |
|---|
| | 287 | est examinée au moment de l'initialisation de la base de la données et plus de mémoire sera allouée s'il est possible |
|---|
| | 288 | de le faire. Le résultat, c'est qu'une configuration par défaut non réglée d'une version récente de PostgreSQL |
|---|
| | 289 | s'exécutera significativement mieux qu'une version plus ancienne. De plus, des changements dans la gestion du cache |
|---|
| | 290 | dans les versions 8.1 et 8.2 permettent même une utilisation plus efficace du cache en quantités modestes. |
|---|
| | 291 | |
|---|
| | 292 | // The primary tunable for both database systems works similarly, by allocating a block of shared memory dedicated to |
|---|
| | 293 | // the database. MySQL tunes this with key_buffer_size when using MyISAM, and with innodb_buffer_pool_size when using |
|---|
| | 294 | // InnoDB (note that you still need some MyISAM space for system tables even when InnoDB is the main storage engine |
|---|
| | 295 | // for regular tables). PostgreSQL sizes its main memory space with shared_buffers. |
|---|
| | 296 | Le premier des réglages sur les deux systèmes fonctionne de façon similaire, en allouant un bloc de mémoire partagée |
|---|
| | 297 | dédiée à la base de données. MySQL règle cela avec key_buffer_size en utilisant MyISAM, et innodb_buffer_pool_siz |
|---|
| | 298 | e avec InnoDB (notez que vous aurez toujours besoin d'un espace MyISAM pour les tables systèmes même lorsque InnoDB |
|---|
| | 299 | est le moteur de stockage principal de vos tables normales). PostgreSQL taille son espace mémoire principal avec |
|---|
| | 300 | shared_buffers. |
|---|
| | 301 | |
|---|
| | 302 | // The MySQL key_buffer_size defaults to using 8MB of memory. Earlier PostgreSQL configurations would also allocate |
|---|
| | 303 | // 8MB of memory for the shared_buffers cache if possible. On a server like a current generation Linux system, it's |
|---|
| | 304 | // expected the recent PostgreSQL releases would set shared_buffers to at least 24MB by default when the database |
|---|
| | 305 | // cluster is created. |
|---|
| | 306 | Dans MySQL, key_buffer_size utilise par défaut 8MB de mémoire. Les premières configurations de PostgreSQL |
|---|
| | 307 | alloueraient aussi 8MB de mémoire pour le cache shared_buffers si possible. Sur un serveur de type linux de |
|---|
| | 308 | génération actuelle, il est admis qu'une version récente de PostgreSQL assigne au moins 24MB par défaut à |
|---|
| | 309 | shared_buffers lors de la création du cluster. |
|---|
| | 310 | |
|---|
| | 311 | // It is still worthwhile to go through the configuration files to tune them to match the available memory on a |
|---|
| | 312 | // database server, as all these defaults are dramatically undersized compared to the amount of RAM in current |
|---|
| | 313 | // systems. For a modern dedicated server, the rule of thumb for both PostgreSQL and MySQL is to size the dedicated |
|---|
| | 314 | // memory to at least 1/4 of the total RAM in the machine, perhaps increasing to as much of 1/2 of RAM on the high |
|---|
| | 315 | // side of normal. It's not out of the question to push this percentage even higher when using systems with very large |
|---|
| | 316 | // amounts of RAM; MySQL InnoDB guidelines suggest even 80% isn't unreasonable. Performance comparisons using the |
|---|
| | 317 | // defaults with either database are completely unrealistic of how a real system would be configured. Initial |
|---|
| | 318 | // guidelines in this area can be found at 5-Minute Introduction to PostgreSQL Performance, Optimizing the mysqld |
|---|
| | 319 | // variables and Optimizing the MySQL Server. |
|---|
| | 320 | Il est toujours possible de parcourir les fichiers de configuration afin de les adapter à la mémoire libre du serveur |
|---|
| | 321 | de la base de données, comme toutes ces valeurs par défaut sont dramatiquement sous-dimensionnées comparé à la |
|---|
| | 322 | quantité de RAM sur les systèmes actuels. Pour un serveur moderne dédié, le principe de base pour PostgreSQL et MySQL |
|---|
| | 323 | est de dimensionner la mémoire dédiée à au moins 1/4 de la mémoire totale de la machine, pouvant grimper à 1/2 de la |
|---|
| | 324 | RAM pour des quantités supérieures à la normale. Il n'est cependant pas hors de question de pousser ce pourcentage |
|---|
| | 325 | encore plus haut sur des systèmes avec une quantité vraiment grande de RAM; Le guide de MySQL InnoDB suggère même que |
|---|
| | 326 | 80% ne soit pas irrésonnable. Les directives initiales dans ce domaine peuvent être trouvées dans |
|---|
| | 327 | "5-Minute Introduction to PostgreSQL Performance", "Optimizing the mysqld variables and Optimizing the MySQL Server". |
|---|
| | 328 | |
|---|
| | 329 | // Benchmarks |
|---|