| 813 | | <command>COPY</command> is fastest when used within the same |
|---|
| 814 | | transaction as an earlier <command>CREATE TABLE</command> or |
|---|
| 815 | | <command>TRUNCATE</command> command. In such cases no WAL |
|---|
| 816 | | needs to be written, because in case of an error, the files |
|---|
| 817 | | containing the newly loaded data will be removed anyway. |
|---|
| 818 | | However, this consideration does not apply when |
|---|
| 819 | | <xref linkend="guc-archive-mode"/> is set, as all commands |
|---|
| 820 | | must write WAL in that case. |
|---|
| | 813 | <command>COPY</command> est plus rapide quand il est utilisé dans la même |
|---|
| | 814 | transaction que la commande <command>CREATE TABLE</command> ou |
|---|
| | 815 | <command>TRUNCATE</command> précédente. Dans ce cas, les journaux de |
|---|
| | 816 | transactions ne sont pas impactés car, en cas d'erreur, les fichiers |
|---|
| | 817 | contenant les données nouvellement chargées seront supprimés de toute |
|---|
| | 818 | façon. Néanmoins, cette considération ne s'applique pas quand |
|---|
| | 819 | <xref linkend="guc-archive-mode"/> est configuré, car toutes les |
|---|
| | 820 | commandes doivent écrire dans les journaux de transaction dans ce cas. |
|---|
| 894 | | <title>Turn off <varname>archive_mode</varname></title> |
|---|
| 895 | | |
|---|
| 896 | | <para> |
|---|
| 897 | | When loading large amounts of data into an installation that uses |
|---|
| 898 | | WAL archiving, you might want to disable archiving (turn off the |
|---|
| 899 | | <xref linkend="guc-archive-mode"/> configuration variable) |
|---|
| 900 | | while loading. It might be |
|---|
| 901 | | faster to take a new base backup after the load has completed |
|---|
| 902 | | than to process a large amount of incremental WAL data. |
|---|
| 903 | | But note that turning <varname>archive_mode</varname> on or off |
|---|
| 904 | | requires a server restart. |
|---|
| 905 | | </para> |
|---|
| 906 | | |
|---|
| 907 | | <para> |
|---|
| 908 | | Aside from avoiding the time for the archiver to process the WAL data, |
|---|
| 909 | | doing this will actually make certain commands faster, because they |
|---|
| 910 | | are designed not to write WAL at all if <varname>archive_mode</varname> |
|---|
| 911 | | is off. (They can guarantee crash safety more cheaply by doing an |
|---|
| 912 | | <function>fsync</function> at the end than by writing WAL.) |
|---|
| 913 | | This applies to the following commands: |
|---|
| | 894 | <title>Désactiver <varname>archive_mode</varname></title> |
|---|
| | 895 | |
|---|
| | 896 | <para> |
|---|
| | 897 | Lors du chargement de grosses quantités de données dans un cluster qui |
|---|
| | 898 | utiliser l'archive des journaux de transaction, vous pouvez souhaiter |
|---|
| | 899 | désactiver l'archivage (désactiver le paramètre <xref |
|---|
| | 900 | linkend="guc-archive-mode"/>) lors du chargement. Il peut être |
|---|
| | 901 | plus rapide de réaliser une nouvelle sauvegarde de base une fois le |
|---|
| | 902 | chargement terminé plutôt que de traiter un grand nombre de données WAL |
|---|
| | 903 | incrémentales. Mais notez qu'activer et désactiver |
|---|
| | 904 | <varname>archive_mode</varname> demande un redémarrage du serveur. |
|---|
| | 905 | </para> |
|---|
| | 906 | |
|---|
| | 907 | <para> |
|---|
| | 908 | En dehors d'éviter le temps de traitement des données WAL, la désactivation |
|---|
| | 909 | rendra certaines commandes plus rapides car elles sont conçues pour ne |
|---|
| | 910 | pas écrire dans les WAL si <varname>archive_mode</varname> est désactivé |
|---|
| | 911 | (elles peuvent garantir une certaine immunité aux arrêts brutaux en |
|---|
| | 912 | exécutant un <function>fsync</function> à la fin plutôt que d'écrire dans |
|---|
| | 913 | les WAL.) Ceci s'applique aux commandes suivantes : |
|---|
| 995 | | If using WAL archiving, consider disabling it during the restore. |
|---|
| 996 | | To do that, turn off <varname>archive_mode</varname> before loading the |
|---|
| 997 | | dump script, and afterwards turn it back on |
|---|
| 998 | | and take a fresh base backup. |
|---|
| 999 | | </para> |
|---|
| 1000 | | </listitem> |
|---|
| 1001 | | <listitem> |
|---|
| 1002 | | <para> |
|---|
| 1003 | | Consider whether the whole dump should be restored as a single |
|---|
| 1004 | | transaction. To do that, pass the <option>-1</option> or |
|---|
| 1005 | | <option>--single-transaction</option> command-line option to |
|---|
| 1006 | | <application>psql</application> or <application>pg_restore</application>. |
|---|
| 1007 | | When using this |
|---|
| 1008 | | mode, even the smallest of errors will rollback the entire restore, |
|---|
| 1009 | | possibly discarding many hours of processing. Depending on how |
|---|
| 1010 | | interrelated the data is, that might seem preferable to manual cleanup, |
|---|
| 1011 | | or not. <command>COPY</command> commands will run fastest if you use a single |
|---|
| 1012 | | transaction and have WAL archiving turned off. |
|---|
| 1013 | | </para> |
|---|
| 1014 | | </listitem> |
|---|
| 1015 | | <listitem> |
|---|
| 1016 | | <para> |
|---|
| 1017 | | Run <command>ANALYZE</command> afterwards. |
|---|
| | 995 | Si vous utilisez l'archivage des WAL, considérez sa désactivation lors |
|---|
| | 996 | de la restauration. Pour cela, désactiver <varname>archive_mode</varname> |
|---|
| | 997 | avant de charger le script de sauvegarde, puis ré-activez-le et réalisez |
|---|
| | 998 | une sauvegarde de base. |
|---|
| | 999 | </para> |
|---|
| | 1000 | </listitem> |
|---|
| | 1001 | <listitem> |
|---|
| | 1002 | <para> |
|---|
| | 1003 | Demandez-vous si la sauvegarde complète doit être restaurée dans une |
|---|
| | 1004 | seule transaction. Pour cela, passez l'option <option>-1</option> ou |
|---|
| | 1005 | <option>--single-transaction</option> à |
|---|
| | 1006 | <application>psql</application> pi <application>pg_restore</application>. |
|---|
| | 1007 | Lors de l'utilisation de ce mode, même les erreurs les plus petites |
|---|
| | 1008 | annuleront la restauration complète, peut-être en annulant des heures de |
|---|
| | 1009 | traitement. Suivant à quel point les données sont en relation, il peut |
|---|
| | 1010 | être préférable de faire un nettoyage manuel. Les commandes |
|---|
| | 1011 | <command>COPY</command> s'exécuteront plus rapidement si vous utilisez une |
|---|
| | 1012 | transaction simple et que vous avez désactivé l'archivage des journaux de |
|---|
| | 1013 | transaction. |
|---|
| | 1014 | </para> |
|---|
| | 1015 | </listitem> |
|---|
| | 1016 | <listitem> |
|---|
| | 1017 | <para> |
|---|
| | 1018 | Exécutez <command>ANALYZE</command> après coup. |
|---|