Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
pg_stat_statementsで inの数が違うSQLをまとめて ほしい
Search
Yasuo Honda
March 24, 2024
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
pg_stat_statementsで inの数が違うSQLをまとめて ほしい
第46回 PostgreSQLアンカンファレンス@東京
Yasuo Honda
March 24, 2024
More Decks by Yasuo Honda
See All by Yasuo Honda
PostgreSQL 18のNOT ENFORCEDな制約とDEFERRABLEの関係
yahonda
1
340
私のRails開発環境
yahonda
0
250
Railsの話をしよう
yahonda
0
290
RailsのPostgreSQL 18対応
yahonda
0
3.8k
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
260
PostgreSQL 18 cancel request key長の変更とRailsへの関連
yahonda
0
340
extensionとschema
yahonda
1
370
NOT VALIDな検査制約 / check constraint that is not valid
yahonda
1
310
今、始める、第一歩。 / Your first step
yahonda
3
1.6k
Other Decks in Programming
See All in Programming
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
110
Android CLI
fornewid
0
220
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
1k
リアルな遅延を測る仕様
kota_yata
1
120
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
650
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
500
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
120
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
180
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
メールのエイリアス機能を履き違えない
isshinfunada
0
240
VibeCodingからAgenticWorkflowへ
starfish719
0
620
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
420
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
770
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
250
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
450
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
480
Mobile First: as difficult as doing things right
swwweet
225
10k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
420
Prompt Engineering for Job Search
mfonobong
0
410
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Transcript
第46回 PostgreSQLアンカンファレンス@東京 Yasuo Honda @yahonda pg_stat_statementsで inの数が違うSQLをまとめて ほしい
• Yasuo Honda @yahonda ◦ Rails committer ◦ 第36回,39回 PostgreSQLアンカンファレンス
から3回目の参加 ▪ 第36回 PostgreSQLアンカンファレンス@オンライン ▪ 第39回 PostgreSQLアンカンファレンス@オンライン - connpass • 遅延可能な制約はRails 7.1からmigrationで作成可能になりました 自己紹介
• IN句の数が違うだけのSQLが異なるSQLとして`pg_stat_statements` に記録される • IN を ANY に書き換えるとANY句の数が違っても単一のSQLとして `pg_stat_statements`に記録されるため、INを全てANYに置き換える pull
requestがRailsに開かれる ◦ https://github.com/rails/rails/pull/49388 • 私はPostgreSQL側で解決して欲しい ◦ https://github.com/rails/rails/pull/49388#issuecomment-1 752253622 背景
• PostgreSQL側でそれを修正するパッチがあることを知る ◦ https://www.postgresql.org/message-id/flat/20230209194 329.z7ectolwilvgppcg%40erthalion.local#be2115b1ac27fedd 45783f57d4e8a6ee • パッチがマージされるためにできることをしたい 背景
• PostgreSQL Conference Japan 2021でこのセッションに出ていた ◦ https://www.slideshare.net/nttdata-tech/postgresql-glob al-development-group-postgresql-conference-japan-2021 -nttdata •
PostgreSQLのmasterブランチをビルドできる環境を持っていた • うっすら覚えていたこと ◦ Issue trackerはなく、メーリングリストで議論が進む ◦ Commitfestという期間でパッチが集中的にレビューされる 知っていたこと
困ったこと
• pgsql-hackersメーリングリストに参加した • 該当スレッドに返信したいが、最新は私の参加前 ◦ https://www.postgresql.org/message-id/flat/CA%2Bq6zc WtUbT_Sxj0V6HY6EZ89uv5wuG5aefpe_9n0Jr3VwntFg%40 mail.gmail.com • どうやってreplyすればいいかわからない
• postgresql-jp Slackで質問 ◦ “Resend email”をおすとそのメールが再送されることを教えてもらう 過去のメーリングリストのメールにreply
• pgsql-hackers • 該当トピックだけ知りたかった • 見逃ししたくなかったので全部メールを受け取っていた • CommitfestのHistoryからこの件だけのメールを受け取っている ◦ https://commitfest.postgresql.org/47/2837
pgsql-hackersメール流量が多い
• C言語、PostgreSQLのコードベースに知見がない ◦ Ruby on Railsからの利用者としてのユースケースしかない • postgresql-jp Slackで質問 ◦
ユースケースを言うだけでも意味があると教えてもらう • 投稿するが、”Moved to next CF”となる ◦ https://www.postgresql.org/message-id/CAKmOUTmDJ_p 9PrEX5vfnS-fz-n8tdYQ6xcApeVrBt5yPkzxgqQ%40mail.gma il.com ◦ https://commitfest.postgresql.org/34/2837/ PostgreSQLのコードベース
• GitHubでのpull requestベースでの開発 ◦ gh pr checkoutなどで、そのcommitがマージされたブランチが手 に入る環境に馴染みがある • .patchファイルの当て方がよくわからない
◦ これは未だに解決していません Patchを当てる方法
知りたいこと、したいこと
• Patchを当てたい ◦ patchコマンドの使い方がよくわからない • PostgreSQL本体にマージされるためにできることをしたい 知りたいこと・したい事
おわり
フォローアップ
• .patchファイルは`git am`で当てられる • Commitfest対象のパッチが最新のmasterブランチとのコンフリクト状 況は”PostgreSQL Patch Tester”でわかる ◦ http://cfbot.cputube.org
◦ リサイクルのようなアイコンはコンフリクトしている ◦ http://cfbot.cputube.org/patch_47_2837.log 教えてもらったこと
• コンフリクトが続くとCommitfestから除外される可能性もあるので、コン フリクトしていることをpgsql-hackersで伝えるのもいい • コンフリクトしないcommit hashを教えてもらってローカルでテストし(私 の観点だと)動作が期待するものではなかったことを返信 ◦ https://www.postgresql.org/message-id/CAKmOUTn74jTQ Ak0u2FUMsGjgrNugLOwkyic2MPkbOJtcQrufeA%40mail.gm
ail.com 教えてもらったこと