Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Redmineのデータ構造が "素晴らしい" 話
Search
北亜 - Hokua
May 26, 2026
Programming
47
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Redmineのデータ構造が "素晴らしい" 話
北亜 - Hokua
May 26, 2026
More Decks by 北亜 - Hokua
See All by 北亜 - Hokua
技術書同人誌を出す - for Those Who Output-
hokua_82
1
16
assets:precompileを眺める w/ Propshaft
hokua_82
0
23
Other Decks in Programming
See All in Programming
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
170
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
470
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
310
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
130
APNsからLive Activityを開始する話
yumnumm
0
160
最近”作らせてる” ローカルAIアプリの話
akit37
0
430
R8 の設定見直しでアプリサイズ削減
andpad
0
190
JRuby: Past, Present, and Future
headius
0
230
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
360
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
280
Building the Perfect Custom Keyboard
takai
2
900
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
930
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
550
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
530
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
How to build a perfect <img>
jonoalderson
1
6.1k
Automating Front-end Workflow
addyosmani
1369
210k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
620
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
940
Transcript
Redmineのデータ構造が "素晴らしい" 話 北亜 - Hokua
自己紹介 • 北亜 - ほくあ ◦ @Hokua_82 • Ruby歴 9年
◦ (まともに書いてるのは) 約2年 • 本業 ◦ Rails / React / erb など…… • VRChat ◦ チュートリアル2周目終 ◦ アバター:しなの/真冬
Redmine • プロジェクトマネジメントツール ◦ Ruby on Rails製 • Rubyのチケット管理とかでも使われてたりします ◦
https://bugs.ruby-lang.org/
Redmineの特徴 • 無限に作れる親子 階層 • 深さ上限なしで「無 限に」深い親子階層 が作れる ◦ チケット
◦ プロジェクト ◦ etc……
親子階層が無限 • シンプルに作るなら各チケット(Issue)が parent_id を保持する形が良さそう • 問題点は取得 ◦ チケットの親子階層を解決しようと思うと、クエリを何度も発行する必要がある •
「隣接リスト」と呼ばれている
Redmineの"素晴らしい"解決 - Nested Sets (入れ子集合) • 木構造を作りたい • 各Issueに左端(lft)と右端(rgt)の情報を持たせる •
親の lft , rgt の内側にあるIssueをそのIssueの子孫として扱 う。
Nested Sets - 入れ子集合 (2)
Nested Sets - 入れ子集合 (3)
Nested Setsが得意なこと • 取得が早い • 1クエリで子孫を全て取得可能
ここが辛いよ Nested Sets UPDATEが地獄 追加位置の lftより 右のチケットを全て 更新する必要がある
終わり • DB構造によって得意なことは変わる ◦ Nested Sets ▪ GETは得意 ▪ UPDATEは苦手
◦ 隣接リスト ▪ GETは苦手 ▪ UPDATEは得意 • サービスの特性によって"素晴らしい"データ構造は変わる 参考資料: Bill Karwin『SQLアンチパターン 第2版』オライリー・ジャパン、2025年