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
0
260
pg_stat_statementsで inの数が違うSQLをまとめて ほしい
第46回 PostgreSQLアンカンファレンス@東京
Yasuo Honda
March 24, 2024
Tweet
Share
More Decks by Yasuo Honda
See All by Yasuo Honda
Railsの話をしよう
yahonda
0
170
RailsのPostgreSQL 18対応
yahonda
0
2.3k
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
180
PostgreSQL 18 cancel request key長の変更とRailsへの関連
yahonda
0
230
extensionとschema
yahonda
1
280
NOT VALIDな検査制約 / check constraint that is not valid
yahonda
1
210
今、始める、第一歩。 / Your first step
yahonda
3
1.3k
RailsのPull requestsのレビューの時に私が考えていること
yahonda
11
7.4k
遅延可能な一意性制約
yahonda
0
1.1k
Other Decks in Programming
See All in Programming
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
140
3年ぶりにコードを書いた元CTOが Claude Codeと30分でMVPを作った話
maikokojima
0
630
contribution to astral-sh/uv
shunsock
0
530
理論と実務のギャップを超える
eycjur
0
180
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
alien-signals と自作 OSS で実現する フレームワーク非依存な ロジック共通化の探求 / Exploring Framework-Agnostic Logic Sharing with alien-signals and Custom OSS
aoseyuu
2
610
CSC305 Lecture 10
javiergs
PRO
0
240
Leading Effective Engineering Teams in the AI Era
addyosmani
7
610
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
7
5.2k
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.9k
CSC509 Lecture 07
javiergs
PRO
0
240
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.5k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
329
39k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
49
51k
Visualization
eitanlees
149
16k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Designing Experiences People Love
moore
142
24k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Navigating Team Friction
lara
190
15k
How to Think Like a Performance Engineer
csswizardry
27
2.1k
What's in a price? How to price your products and services
michaelherold
246
12k
Designing for humans not robots
tammielis
254
26k
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 教えてもらったこと