PostgreSQL Conference Japan 2017の資料です。
PostgreSQLが苦手な全文検索機能を強力に補完する拡張機能PGroongaの最新情報を紹介します。PGroongaは単なる全文検索モジュールではありません。PostgreSQLで簡単にリッチな全文検索システムを実現するための機能一式を提供します。PGroongaは最新PostgreSQLへの対応も積極的です。例としてロジカルレプリケーションと組み合わせた活用方法も紹介します。
29回勉強会資料「PostgreSQLのリカバリ超入門」
See also http://www.interdb.jp/pgsql (Coming soon!)
初心者向け。PostgreSQLのWAL、CHECKPOINT、 オンラインバックアップの仕組み解説。
これを見たら、次は→ http://www.slideshare.net/satock/29shikumi-backup
29回勉強会資料「PostgreSQLのリカバリ超入門」
See also http://www.interdb.jp/pgsql (Coming soon!)
初心者向け。PostgreSQLのWAL、CHECKPOINT、 オンラインバックアップの仕組み解説。
これを見たら、次は→ http://www.slideshare.net/satock/29shikumi-backup
Remixing Vol.3 with オールアバウト and LIG
https://remixing.doorkeeper.jp/events/34982
で発表した資料になります。
CMS開発を汎用CMSを使うのかフルスクラッチするのか。
また、LaravelでフルスクラッチCMSを作る時のノウハウなどについて。
【MT東京−31】バレンタインデー1ヶ月前から始めるSwift×MT Data APIでのLT登壇資料になります。
Firebaseを使用したサンプル作成にあたり、ファイルアップロード処理の際に実装に詰まった経験やデータ設計の整理に苦労しました。
その経験からFirebaseを扱いやすくするライブラリ「Salada」を導入してサンプルアプリを作成した際の知見や実装ポイント等をまとめました。
Redmineに全文検索エンジンGroongaサポートを追加する「Full Text Search」プラグインを紹介します。このプラグインを使えば数十万チケットがあるRedmineでも高速に目的の情報を見つけられます。高速になるという現状の話だけでなく、Redmine内のデータを有効活用するという今後の話もします。
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowKouhei Sutou
I introduced Ruby and Apache Arrow integration including the "super fast large data interchange and processing" Apache Arrow feature at RubyKaigi Takeout 2021.
This talk introduces how we can use the "super fast large data interchange and processing" Apache Arrow feature in Ruby. Here are some use cases:
* Fast data retrieval (fast pluck) from DB such as MySQL and PostgreSQL for batch processes in a Ruby on Rails application
* Fast data interchange with JavaScript for dynamic visualization in a Ruby on Rails application
* Fast OLAP with in-process DB such as DuckDB and Apache Arrow DataFusion in a Ruby on Rails application or irb session
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowKouhei Sutou
To use Ruby for data processing widely, Apache Arrow support is important. We can do the followings with Apache Arrow:
* Super fast large data interchange and processing
* Reading/writing data in several famous formats such as CSV and Apache Parquet
* Reading/writing partitioned large data on cloud storage such as Amazon S3
This talk describes the followings:
* What is Apache Arrow
* How to use Apache Arrow with Ruby
* How to integrate with Ruby 3.0 features such as MemoryView and Ractor
Apache Arrow 1.0 - A cross-language development platform for in-memory dataKouhei Sutou
Apache Arrow is a cross-language development platform for in-memory data. You can use Apache Arrow to process large data effectively in Python and other languages such as R. Apache Arrow is the future of data processing. Apache Arrow 1.0, the first major version, was released at 2020-07-24. It's a good time to know Apache Arrow and start using it.
Apache Arrow - A cross-language development platform for in-memory dataKouhei Sutou
Apache Arrow is the future for data processing systems. This talk describes how to solve data sharing overhead in data processing system such as Spark and PySpark. This talk also describes how to accelerate computation against your large data by Apache Arrow.
csv, one of the standard libraries, in Ruby 2.6 has many improvements:
* Default gemified
* Faster CSV parsing
* Faster CSV writing
* Clean new CSV parser implementation for further improvements
* Reconstructed test suites for further improvements
* Benchmark suites for further performance improvements
These improvements are done without breaking backward compatibility.
This talk describes details of these improvements by a new csv maintainer.
PGroonga 2 – Make PostgreSQL rich full text search system backend!Kouhei Sutou
PGroonga 2.0 has been released with 2 years development since PGroonga 1.0.0. PGroonga 1.0.0 just provides fast full text search with all languages support. It's important because it's a lacked feature in PostgreSQL. PGroonga 2.0 provides more useful features to implement rich full text search system with PostgreSQL. This session shows how to implement rich full text search system with PostgreSQL!
This talk describes about PGroonga that resolves these problems.
PGroonga is fast and flexible full text search extension for PostgreSQL. Zulip is a chat tool that uses PostgreSQL and PGroonga. This talk describes why PGroonga is suitable for Zulip.
セル生産方式におけるロボットの活用には様々な問題があるが,その一つとして 3 体以上の物体の組み立てが挙げられる.一般に,複数物体を同時に組み立てる際は,対象の部品をそれぞれロボットアームまたは治具でそれぞれ独立に保持することで組み立てを遂行すると考えられる.ただし,この方法ではロボットアームや治具を部品数と同じ数だけ必要とし,部品数が多いほどコスト面や設置スペースの関係で無駄が多くなる.この課題に対して音𣷓らは組み立て対象物に働く接触力等の解析により,治具等で固定されていない対象物が組み立て作業中に運動しにくい状態となる条件を求めた.すなわち,環境中の非把持対象物のロバスト性を考慮して,組み立て作業条件を検討している.本研究ではこの方策に基づいて,複数物体の組み立て作業を単腕マニピュレータで実行することを目的とする.このとき,対象物のロバスト性を考慮することで,仮組状態の複数物体を同時に扱う手法を提案する.作業対象としてパイプジョイントの組み立てを挙げ,簡易な道具を用いることで単腕マニピュレータで複数物体を同時に把持できることを示す.さらに,作業成功率の向上のために RGB-D カメラを用いた物体の位置検出に基づくロボット制御及び動作計画を実装する.
This paper discusses assembly operations using a single manipulator and a parallel gripper to simultaneously
grasp multiple objects and hold the group of temporarily assembled objects. Multiple robots and jigs generally operate
assembly tasks by constraining the target objects mechanically or geometrically to prevent them from moving. It is
necessary to analyze the physical interaction between the objects for such constraints to achieve the tasks with a single
gripper. In this paper, we focus on assembling pipe joints as an example and discuss constraining the motion of the
objects. Our demonstration shows that a simple tool can facilitate holding multiple objects with a single gripper.
【DLゼミ】XFeat: Accelerated Features for Lightweight Image Matchingharmonylab
公開URL:https://arxiv.org/pdf/2404.19174
出典:Guilherme Potje, Felipe Cadar, Andre Araujo, Renato Martins, Erickson R. ascimento: XFeat: Accelerated Features for Lightweight Image Matching, Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) (2023)
概要:リソース効率に優れた特徴点マッチングのための軽量なアーキテクチャ「XFeat(Accelerated Features)」を提案します。手法は、局所的な特徴点の検出、抽出、マッチングのための畳み込みニューラルネットワークの基本的な設計を再検討します。特に、リソースが限られたデバイス向けに迅速かつ堅牢なアルゴリズムが必要とされるため、解像度を可能な限り高く保ちながら、ネットワークのチャネル数を制限します。さらに、スパース下でのマッチングを選択できる設計となっており、ナビゲーションやARなどのアプリケーションに適しています。XFeatは、高速かつ同等以上の精度を実現し、一般的なラップトップのCPU上でリアルタイムで動作します。
28. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
ベンチマーク:pg_bigm
0
0.5
1
1.5
2
2.5
3
311 14706 20389
Data: Japanese Wikipedia
(Many records and large documents)
N records: About 0.9millions
Average text size: 6.7KiB
Slow
Slow
Elapsedtime(sec)
(Lowerisbetter)
N hits
pg_bigm
29. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
ベンチマーク:PGroonga
0
0.5
1
1.5
2
2.5
3
311 14706 20389
Data: Japanese Wikipedia
(Many records and large documents)
N records: About 0.9millions
Average text size: 6.7KiB
Fast Fast
Elapsedtime(sec)
(Lowerisbetter)
N hits
PGroonga pg_bigm
32. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
高度な機能
オートコンプリート
ローマ字対応(zen→全文検索)
類似文書検索
同義語展開
「牛乳」→
「牛乳 OR ミルク」
33. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
高速全文検索+ソート
34. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
テーブル定義
CREATE TABLE entries (
-- 主キーを用意する
-- それっぽい順でソートするために必要
id integer PRIMARY KEY,
title text,
content text
);
35. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
インデックス定義
-- 全文検索用インデックス
-- よくわからないなら
-- デフォルトのまま使うこと!
CREATE INDEX entries_full_text_search
ON entries
--「USING PGroonga」=「PGroongaを使う」
-- 主キーはそれっぽい順ソートのため!
USING PGroonga (id, title, content);
36. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
データ挿入
-- 普通に挿入するだけでよい
INSERT INTO entries
VALUES (1,
'Groongaで高速全文検索!',
'高速に全文検索したいですね!');
37. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
全文検索
SELECT title FROM entries
WHERE
-- &@~で全文検索
-- 「検索」と「高速」をAND検索
title &@~ '検索 高速' OR
content &@~ '検索 高速';
38. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
全文検索:LIKE
SELECT title FROM entries
WHERE
-- LIKEでもインデックスが効く
--=アプリを書き換えずに高速化可能
-- ただし&@~より性能が落ちる
title LIKE '%検索%' OR
content LIKE '%検索%';
39. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
それっぽい順のソート
SELECT
title,
-- pgroonga_score(テーブル名)で
-- それっぽさを数値で取得
pgroonga_score(entries) AS score
FROM entries
WHERE -- ...
-- それっぽさでソート
ORDER BY score DESC LIMIT 10;
40. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
キーワードハイライト
41. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
HTML用にハイライト
SELECT
pgroonga_highlight_html(
title,
-- クエリーから対象キーワードを抽出
pgroonga_query_extract_keywords('検索 高速'))
FROM entries
WHERE title &@~ '検索 高速' OR
content &@~ '検索 高速';
52. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
前方一致用インデックス
CREATE INDEX prefix_search ON terms
USING PGroonga
-- ...text_array_term_search...
(readings pgroonga_text_array_term_search_ops_v2);
53. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
緩い全文検索用
CREATE INDEX loose_search ON terms
USING PGroonga (term)
-- 緩い全文検索用トークナイザー
WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit');
54. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索方法
SELECT term FROM terms
-- ヨミで前方一致検索
WHERE readings &^~ '${入力}' OR
-- 緩い全文検索
term &@ '${入力}'
ORDER BY term LIMIT 10; -- ソート
55. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索例:漢字1
-- ユーザーが「牛」を入力した場合
SELECT term FROM terms
-- ヨミで前方一致検索
WHERE readings &^~ '牛' OR
-- 緩い全文検索(ヒット)
term &@ '牛'
ORDER BY term LIMIT 10; -- ソート
56. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索例:漢字2
-- ユーザーが「乳」を入力した場合
SELECT term FROM terms
-- ヨミで前方一致検索
WHERE readings &^~ '乳' OR
-- 緩い全文検索(ヒット)
term &@ '乳'
ORDER BY term LIMIT 10; -- ソート
57. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索例:カタカナ
-- ユーザーが「ギュウ」を入力した場合
SELECT term FROM terms
-- ヨミで前方一致検索(ヒット)
WHERE readings &^~ 'ギュウ' OR
-- 緩い全文検索
term &@ 'ギュウ'
ORDER BY term LIMIT 10; -- ソート
58. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索例:ひらがな
-- ユーザーが「ぎゅう」を入力した場合
SELECT term FROM terms
-- ヨミで前方一致検索(ヒット)
WHERE readings &^~ 'ぎゅう' OR
-- 緩い全文検索
term &@ 'ぎゅう'
ORDER BY term LIMIT 10; -- ソート
59. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
オートコンプリート
検索例:ローマ字
-- ユーザーが「gyu」を入力した場合
SELECT term FROM terms
-- ヨミで前方一致検索(ヒット)
WHERE readings &^~ 'gyu' OR
-- 緩い全文検索
term &@ 'gyu'
ORDER BY term LIMIT 10; -- ソート
67. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
同義語展開:検索方法
SELECT title FROM entries
WHERE
-- title &@~ 'アイス ((牛乳) OR (ミルク))'になる
title &@~
pgroonga_query_expand('synonyms',
'term',
'terms',
'アイス 牛乳');
68. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
類似文書検索
92. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
ロジカルレプリケーション
テーブル作成
-- マスター
CREATE TABLE memos (
id integer PRIMARY KEY,
content text
);
CREATE INDEX
full_text_search_index ON memos
USING pgroonga (id, content);
93. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
ロジカルレプリケーション
レプリケーション用ユーザー作成
-- マスター
-- pg_hba.confも編集すること
CREATE ROLE replica
WITH REPLICATION
LOGIN PASSWORD 'pass';
GRANT SELECT
ON ALL TABLES IN SCHEMA public
TO replica;
94. PGroonga 2 - PostgreSQLでの全文検索の決定版 Powered by Rabbit 2.2.2
ロジカルレプリケーション
publication作成
-- マスター
CREATE PUBLICATION pub
FOR TABLE memos;