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
社内LT2019/11/7
Search
Kento Matsumoto
November 07, 2019
Programming
93
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内LT2019/11/7
Kento Matsumoto
November 07, 2019
More Decks by Kento Matsumoto
See All by Kento Matsumoto
ストーリーポイント.pdf
stepanve
0
110
社内LT2020/01/23
stepanve
0
60
社内LT2019/11/21
stepanve
0
70
社内LT2019/10/24
stepanve
0
81
Other Decks in Programming
See All in Programming
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
760
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
370
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
210
The Rails Doctrine Decade
koic
2
460
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
220
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
440
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
670
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.3k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
300
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
290
カツオ、ご期待ください
suneo3476
0
140
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
510
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Language of Interfaces
destraynor
162
27k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
470
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
Paper Plane
katiecoart
PRO
4
53k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
500
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
590
Optimizing for Happiness
mojombo
378
71k
Transcript
PostgreSQLの便利な機能 社内勉強会:2019/11/7
テーブルとスキーマについて -- スキーマ作成 CREATE SCHEMA schema1; -- テーブル作成 CREATE TABLE
schema1.table( Id INTEGER ); -- スキーマの優先順位の調べ方 show search_path; Postgresには、データベースの中にスキーマという概念が存在する ※MySQLの場合、データベースとスキーマは同じ概念である DB1 DB2 schema1 table table schema1 同一DBに同じテー ブル名が作れる。 スキーマを指定せず に使用する場合 search_pathの順番 で検索される。
スキーマの目的 •1つのデータベースを多数のユーザが互いに干渉することなく使用できるようにする ため。 • 管理しやすくなるよう、データベースオブジェクトを論理グループに編成するため •サードパーティのアプリケーションを別々のスキーマに入れることにより、他のオブ ジェクトの名前と競合しないようにするため。 引用:https://www.postgresql.jp/document/9.4/html/ddl-schemas.html データベース内のアクセス権限を管理しやすくするため
式インデックス Indexに式を設定することができる。(ユニークキーとしても可能) -- インデックス作成 CREATE INDEX users_lower_id_idx ON users (lower(id));
-- 検索 EXPLAIN SELECT * FROM users WHERE lower(id) = '1'; * 省略 " -> Bitmap Index Scan on users_lower_id_idx (cost=0.00..4.53 rows=33 width=0)" Index Cond: (lower((id)::text) = '1'::text)
Materialized View - SQLの状態を保存することができる - 直接更新できない - 更新するタイミングを指定する必要がある (REFRESH MATERIALIZED
VIEW viewtable;) - Viewの場合、テーブルの内容を常に反映させるが、一度保存したものを使い回すため、リ ソースを使わないで済む (高速化)。 -- Materialized View 作成 CREATE MATERIALIZED VIEW viewtable AS SELECT * FROM users ORDER BY id LIMIT 10; -- Materialized View 更新 REFRESH MATERIALIZED VIEW viewtable; リアルタイム性が求められないような週次レポートのようなものに最適