SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
PostgreSQLで学ぶ
Boyer-Moor-Horspool法
概要
    8.4では、position()、strpos()、replace()、split_part()
●


    、string_to_array()のアルゴリズムが改善されている
    LIKE '%hoge%'よりもstrpos() > 0の方が速そう
●


        SELECT strpos('high', 'ig') => 2
    ●


        SELECT strpos('high', 'X') => 0
    ●
PostgreSQLのしくみに興味が無い方向けの情報は
●


    は、ここで終了
概要(2)
    Boyer-Moore-Horspoolアルゴリズムについて学ぼう
●



    PostgreSQLのシステムカタログや関数の実装につい
●


    て学ぼう
B-M-H法とは
    文字列検索アルゴリズム
●



    PostgreSQL8.4で実装された
●


        Knuth-Morris-Pratt
    ●


        Boyer-Moore
    ●


        Boyer-Moore-Horspool(HORSPOOL R.N., 1980, Practical
    ●

        fast searching in strings)
        Sunday Quick Search
    ●
詳しくはWebで!!
●


        http://en.wikipedia.org/wiki/Boyer-Moore-Horspool_algorithm
    ●


        http://www-igm.univ-mlv.fr/~lecroq/string/index.html
    ●


        http://www.hgc.jp/~tshibuya/classes/
    ●
なんでもかんでもシステムカタログ
●


        pg_proc - 関数
    ●



        pg_operator - 演算子
    ●



        pg_type - データ型
    ●



        pg_cast - キャスト
    ●



        等々
    ●



    select prosrc from pg_proc where proname = 'strpos';
●
src/backend/utils/adt/varlena.c
●


        text型、varchar型関係の関数が詰まってる
    ●



        src/backend/utils/adt/には関数や演算子など、組み込みデー
    ●


        タ型を扱う関数が詰まってる
ポイント
    不一致だった場合に何文字スキップできるかは、
●


    patternの末尾の比較対象の文字によって決まる
    簡易実装では、256個の配列でbad-char-tableを持って
●


    いる
    日本語どうすんの?
●
multibyte/widechar
    マルチバイト
●


        可変長
    ●



        ASCII互換
    ●



        EUC-JP、UTF-8
    ●



    ワイド文字
●


        固定長(16bit/32bit)
    ●



        ASCII非互換
    ●



        UTF-16(?)、UTF-32
    ●



        別にUNICODEじゃなくてもいいけどね
    ●



    src/backend/utils/mb/wchar.c
●
LIKE '%hoge%'よりもstrpos()の方が速そう
●


        自動的に最適化できれば嬉しいんだけど、、、
    ●



        pat[0] = '%' && pat[last] = '%'であればstrpos()するとしたい
    ●


        ところだけれど、like_escapeがあるので
    skiptablemaskを決めてる根拠がよくわからない。と
●


    いうか調べてない

Más contenido relacionado

La actualidad más candente

Keranigonj text part 9
Keranigonj text part 9Keranigonj text part 9
Keranigonj text part 9Nasrul Hamid
 
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟taiwanweb20
 
Labor Policy - handout Bangla
Labor Policy - handout BanglaLabor Policy - handout Bangla
Labor Policy - handout BanglaJhuma Halder
 
Search Engines Chapter 1 Summary
Search Engines Chapter 1 SummarySearch Engines Chapter 1 Summary
Search Engines Chapter 1 Summarysleepy_yoshi
 
自作言語でお絵描き
自作言語でお絵描き自作言語でお絵描き
自作言語でお絵描きuchan_nos
 
Accounting 0137 chapter 7 lecture 3
Accounting 0137 chapter 7 lecture 3Accounting 0137 chapter 7 lecture 3
Accounting 0137 chapter 7 lecture 3Cambriannews
 
Topic 2 collage presentation
Topic 2 collage presentationTopic 2 collage presentation
Topic 2 collage presentationtreymazza
 
Educational Psychology
Educational PsychologyEducational Psychology
Educational Psychologykamyonlinebd
 
Estonia and estonian people
Estonia and estonian peopleEstonia and estonian people
Estonia and estonian peopleNadyyy
 
アジャイル事例紹介 —夜のおしごと編—
アジャイル事例紹介 —夜のおしごと編—アジャイル事例紹介 —夜のおしごと編—
アジャイル事例紹介 —夜のおしごと編—Fumihiko Kinoshita
 
WxHaskell
WxHaskellWxHaskell
WxHaskellina job
 
GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門bose999
 
資料庫期末Project Proposal
資料庫期末Project Proposal資料庫期末Project Proposal
資料庫期末Project ProposalFrank Chang
 
Homework, Jan 13
Homework, Jan 13Homework, Jan 13
Homework, Jan 13Kelly Neal
 
Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門shigeya
 
Stpetersburgwebhostingbest
StpetersburgwebhostingbestStpetersburgwebhostingbest
StpetersburgwebhostingbestMichael Murray
 

La actualidad más candente (20)

Profiling
ProfilingProfiling
Profiling
 
Keranigonj text part 9
Keranigonj text part 9Keranigonj text part 9
Keranigonj text part 9
 
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟
創業家研習營-7分鐘創意簡報技巧,Mr.6劉威麟
 
Labor Policy - handout Bangla
Labor Policy - handout BanglaLabor Policy - handout Bangla
Labor Policy - handout Bangla
 
Search Engines Chapter 1 Summary
Search Engines Chapter 1 SummarySearch Engines Chapter 1 Summary
Search Engines Chapter 1 Summary
 
自作言語でお絵描き
自作言語でお絵描き自作言語でお絵描き
自作言語でお絵描き
 
Accounting 0137 chapter 7 lecture 3
Accounting 0137 chapter 7 lecture 3Accounting 0137 chapter 7 lecture 3
Accounting 0137 chapter 7 lecture 3
 
22
2222
22
 
Topic 2 collage presentation
Topic 2 collage presentationTopic 2 collage presentation
Topic 2 collage presentation
 
Educational Psychology
Educational PsychologyEducational Psychology
Educational Psychology
 
2.36
2.362.36
2.36
 
Estonia and estonian people
Estonia and estonian peopleEstonia and estonian people
Estonia and estonian people
 
アジャイル事例紹介 —夜のおしごと編—
アジャイル事例紹介 —夜のおしごと編—アジャイル事例紹介 —夜のおしごと編—
アジャイル事例紹介 —夜のおしごと編—
 
WxHaskell
WxHaskellWxHaskell
WxHaskell
 
GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門
 
資料庫期末Project Proposal
資料庫期末Project Proposal資料庫期末Project Proposal
資料庫期末Project Proposal
 
Homework, Jan 13
Homework, Jan 13Homework, Jan 13
Homework, Jan 13
 
XS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt JapaneseXS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt Japanese
 
Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門
 
Stpetersburgwebhostingbest
StpetersburgwebhostingbestStpetersburgwebhostingbest
Stpetersburgwebhostingbest
 

Destacado

PostgreSQLの範囲型と排他制約
PostgreSQLの範囲型と排他制約PostgreSQLの範囲型と排他制約
PostgreSQLの範囲型と排他制約Akio Ishida
 
よりよいPHPUnitの実行方法を求めて
よりよいPHPUnitの実行方法を求めてよりよいPHPUnitの実行方法を求めて
よりよいPHPUnitの実行方法を求めてAkio Ishida
 
phpspecで学ぶLondon School TDD
phpspecで学ぶLondon School TDDphpspecで学ぶLondon School TDD
phpspecで学ぶLondon School TDDAkio Ishida
 
Prophecyを使ったユニットテスト
Prophecyを使ったユニットテスト Prophecyを使ったユニットテスト
Prophecyを使ったユニットテスト Akio Ishida
 

Destacado (6)

PostgreSQLの範囲型と排他制約
PostgreSQLの範囲型と排他制約PostgreSQLの範囲型と排他制約
PostgreSQLの範囲型と排他制約
 
よりよいPHPUnitの実行方法を求めて
よりよいPHPUnitの実行方法を求めてよりよいPHPUnitの実行方法を求めて
よりよいPHPUnitの実行方法を求めて
 
使ってみませんか?pg_hint_plan
使ってみませんか?pg_hint_plan使ってみませんか?pg_hint_plan
使ってみませんか?pg_hint_plan
 
phpspecで学ぶLondon School TDD
phpspecで学ぶLondon School TDDphpspecで学ぶLondon School TDD
phpspecで学ぶLondon School TDD
 
JSONBはPostgreSQL9.5でいかに改善されたのか
JSONBはPostgreSQL9.5でいかに改善されたのかJSONBはPostgreSQL9.5でいかに改善されたのか
JSONBはPostgreSQL9.5でいかに改善されたのか
 
Prophecyを使ったユニットテスト
Prophecyを使ったユニットテスト Prophecyを使ったユニットテスト
Prophecyを使ったユニットテスト
 

Similar a PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム

Gorm @ gopher china
Gorm @ gopher chinaGorm @ gopher china
Gorm @ gopher chinaJinzhu
 
Development toolsforteamdevelopment
Development toolsforteamdevelopmentDevelopment toolsforteamdevelopment
Development toolsforteamdevelopmentTakao Tetsuro
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTracterada
 
Linux Commands
Linux CommandsLinux Commands
Linux Commandsiwata
 
ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理Shinya Miyazaki
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」devsumi2009
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS RESTocha_kaneko
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad MobileHiroshi Sakai
 
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Yusuke Kawasaki
 
20090522 Candycane
20090522 Candycane20090522 Candycane
20090522 CandycaneYusuke Ando
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編mochiko AsTech
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編mochiko AsTech
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPAtsuhiro Kubo
 
Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720Sukusuku Scrum
 
20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説mochiko AsTech
 
4200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.04200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.0wayneliao
 

Similar a PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム (20)

Gorm @ gopher china
Gorm @ gopher chinaGorm @ gopher china
Gorm @ gopher china
 
Development toolsforteamdevelopment
Development toolsforteamdevelopmentDevelopment toolsforteamdevelopment
Development toolsforteamdevelopment
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
 
Ruby Postgres
Ruby PostgresRuby Postgres
Ruby Postgres
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad Mobile
 
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
 
Reloaded
ReloadedReloaded
Reloaded
 
20090522 Candycane
20090522 Candycane20090522 Candycane
20090522 Candycane
 
sigfpai73-kaji
sigfpai73-kajisigfpai73-kaji
sigfpai73-kaji
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編
 
Spring Framework勉強会
Spring  Framework勉強会Spring  Framework勉強会
Spring Framework勉強会
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
 
Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720
 
20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説
 
4200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.04200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.0
 

Más de Akio Ishida

Getting start with knockout.js
Getting start with knockout.jsGetting start with knockout.js
Getting start with knockout.jsAkio Ishida
 
XIDを周回させてみよう
XIDを周回させてみようXIDを周回させてみよう
XIDを周回させてみようAkio Ishida
 
Local php-100828 2
Local php-100828 2Local php-100828 2
Local php-100828 2Akio Ishida
 
Rubysapporo Stringsearch
Rubysapporo StringsearchRubysapporo Stringsearch
Rubysapporo StringsearchAkio Ishida
 
Ruby Postgres 2009
Ruby Postgres 2009Ruby Postgres 2009
Ruby Postgres 2009Akio Ishida
 
textsearch_jaで全文検索
textsearch_jaで全文検索textsearch_jaで全文検索
textsearch_jaで全文検索Akio Ishida
 

Más de Akio Ishida (6)

Getting start with knockout.js
Getting start with knockout.jsGetting start with knockout.js
Getting start with knockout.js
 
XIDを周回させてみよう
XIDを周回させてみようXIDを周回させてみよう
XIDを周回させてみよう
 
Local php-100828 2
Local php-100828 2Local php-100828 2
Local php-100828 2
 
Rubysapporo Stringsearch
Rubysapporo StringsearchRubysapporo Stringsearch
Rubysapporo Stringsearch
 
Ruby Postgres 2009
Ruby Postgres 2009Ruby Postgres 2009
Ruby Postgres 2009
 
textsearch_jaで全文検索
textsearch_jaで全文検索textsearch_jaで全文検索
textsearch_jaで全文検索
 

Último

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム

  • 2. 概要 8.4では、position()、strpos()、replace()、split_part() ● 、string_to_array()のアルゴリズムが改善されている LIKE '%hoge%'よりもstrpos() > 0の方が速そう ● SELECT strpos('high', 'ig') => 2 ● SELECT strpos('high', 'X') => 0 ●
  • 4. 概要(2) Boyer-Moore-Horspoolアルゴリズムについて学ぼう ● PostgreSQLのシステムカタログや関数の実装につい ● て学ぼう
  • 5. B-M-H法とは 文字列検索アルゴリズム ● PostgreSQL8.4で実装された ● Knuth-Morris-Pratt ● Boyer-Moore ● Boyer-Moore-Horspool(HORSPOOL R.N., 1980, Practical ● fast searching in strings) Sunday Quick Search ●
  • 6. 詳しくはWebで!! ● http://en.wikipedia.org/wiki/Boyer-Moore-Horspool_algorithm ● http://www-igm.univ-mlv.fr/~lecroq/string/index.html ● http://www.hgc.jp/~tshibuya/classes/ ●
  • 7. なんでもかんでもシステムカタログ ● pg_proc - 関数 ● pg_operator - 演算子 ● pg_type - データ型 ● pg_cast - キャスト ● 等々 ● select prosrc from pg_proc where proname = 'strpos'; ●
  • 8. src/backend/utils/adt/varlena.c ● text型、varchar型関係の関数が詰まってる ● src/backend/utils/adt/には関数や演算子など、組み込みデー ● タ型を扱う関数が詰まってる
  • 9. ポイント 不一致だった場合に何文字スキップできるかは、 ● patternの末尾の比較対象の文字によって決まる 簡易実装では、256個の配列でbad-char-tableを持って ● いる 日本語どうすんの? ●
  • 10. multibyte/widechar マルチバイト ● 可変長 ● ASCII互換 ● EUC-JP、UTF-8 ● ワイド文字 ● 固定長(16bit/32bit) ● ASCII非互換 ● UTF-16(?)、UTF-32 ● 別にUNICODEじゃなくてもいいけどね ● src/backend/utils/mb/wchar.c ●
  • 11. LIKE '%hoge%'よりもstrpos()の方が速そう ● 自動的に最適化できれば嬉しいんだけど、、、 ● pat[0] = '%' && pat[last] = '%'であればstrpos()するとしたい ● ところだけれど、like_escapeがあるので skiptablemaskを決めてる根拠がよくわからない。と ● いうか調べてない