In PowerShell on Windows 10, you cannot change the current culture (locale) with chcp command.
If you want to launch a new PowerShell process in another culture, once run cmd.exe from PowerShell, execute chcp, and launch powershell.exe from cmd.exe.
This is useful when you want to get an error message in en-US culture to ask questions in forums like Stack Overflow.
PS C:\> [Threading.Thread]::CurrentThread.CurrentUICulture.Name
ja-JP
PS C:\> cmd.exe
Microsoft Windows [Version 10.0.18362.836]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\>chcp 437
Active code page: 437
C:\>powershell.exe
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\> [Threading.Thread]::CurrentThread.CurrentUICulture.Name
en-US
PS C:\>
pgbench.exe -U postgres -c 20 -T 20 -f C:\tmp\insert.pgbench test
この場合のTPSは3863TPSでした。
transaction type: C:\tmp\insert.pgbench
scaling factor: 1
query mode: simple
number of clients: 20
number of threads: 1
duration: 20 s
number of transactions actually processed: 77323
latency average = 5.177 ms
tps = 3863.290450 (including connections establishing)
tps = 3873.891699 (excluding connections establishing)
In Windows, you can set the CPU affinity of an user process with Start-ProcessPowerShell cmdlet and System.Diagnostics.Process.ProcessorAffinity property like this:
You cannot set CPU affinity of an PostgreSQL instance with Start-Process cmdlet and System.Diagnostics.Process.ProcessorAffinity property, when you start the instance through pg_ctl.
You will get SetValueInvocationException like this:
In PowerShell, it seems there are no ways to set CPU affinity of an user process when it starts.
ProcessorAffinity property sets CPU affinity of an user process through Process object retrieved before it accessed.
In PostgreSQL, pg_ctl command exits immediately after it starts an PostgreSQL instance. If the process is exited before you set ProcessorAffinity, you cannot set CPU affinity.
Solution
You have to use start /affinity command in cmd.exe instead of Start-Process.
For example, you can start PostgreSQL instance with CPU affinity from PowerShell like this: