Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

PostgreSQL

PostgreSQLの教育にPostgres-WASMを使う

大量のデータをINSERTしようとするとエラーになる 600行くらいのINSERTを一気に実行しようとすると以下のエラーが出る。 psql:/mnt/test.sql:665: server closed the connection unexpectedly This probably means the server terminated abnormally before …

SupabaseのPostgres-WASM環境にDBの初期データをロードする

やりたいこと SupabaseのPostgres-WASM環境に、PostgreSQLの教育用DBを構築したい。 問題(1) DDLを含むSQL文をPostgreSQL-WASM環境のコンソールにコピー&ペーストしようとすると、ある程度の分量(100kBくらい?もっと少ない?)までは問題なく実行できる。…

Postgres-WASMの環境に日本語を入力できない

問題 Postgres-WASMをオンラインで試せるサイト、たとえばSupabaseのPostgres-WASMやCrunchy DataのPostgres-WASMを使ったチュートリアルでは、コンソールから日本語を入力しようとすると文字化けしてしまう。たとえば、Linkedin LearningのSQL基本講座の内…

pgbenchでINSERT中心のトランザクションのTPSをできるだけ高くする

動機 DBのチューニング方法なんかの書籍を見てみても、性能向上方法として語られているのはSELECTのチューニングが主で、INSERTに関する記載はあまり見当たりませんでした。ですが、大量のデバイスから飛んできたデータをMQTTやらHTTPやらで受けて、それを生…

You cannot set CPU affinity of PostgreSQL instance started through pg_ctl with Start-Process and Process.ProcessorAffinity

Background: In Windows, you can set the CPU affinity of an user process with Start-Process PowerShell cmdlet and System.Diagnostics.Process.ProcessorAffinity property like this: $app = Start-Process -FilePath C:\Windows\System32\mspaint.ex…

An error in pgbench: invalid command in command "setrandom"

Background: I tried to run the following transaction script on pgbench contained in PostgreSQL 12: \set nbranches 1 * :scale \set ntellers 10 * :scale \set naccounts 100000 * :scale \setrandom aid 1 :naccounts \setrandom bid 1 :nbranches \…