SlideShare a Scribd company logo
1 of 19
Download to read offline
2011 3   4




2011   3   5
•                  DB




       • Index
         Index                 Covering Index   Primary Key
           Read   Write


       • MySQL
                                DB                            SQL




2011   3   5
•


           →(10001,A)
           ※


       •
                          Primary Key
           →Primary Key


       •
                            Primary Key



2011   3   5
•




                            ID
                   ID
                        1
               1
                        2
               2
                        2




2011   3   5
•
                                             ID           ID

                                      1           10001

                                      1           10002

                                      2           10001
                   ID           ID

               1        10001         2           10002

               1        10002

               2        10001

               2        10002                ID

                                     10001

                                     10002




2011   3   5
•

                                        ID     ID
                               1             101
                               2             102
                   ID     ID   3             103

               1        101    4             102

               2        102

               3        103

               4        102        ID
                               101
                               102
                               103




2011   3   5
ALTER TABLE

       •


       •                            (ALTER TABLE)
           →ALTER TABLE


       •




       •


           →



2011   3   5
ID                         ID
                   1               1         101               1
                   1               2         234               2
                   1               3         553               3
                   1               4         232               4
                   2               1         102
                   2               2         271
                   2               3         952


                   ID
               1             101       234    553       232   873   0     102   0
               2             102       271    8652      98    0     234   202   0
               3             103       952     76       765   872   45     0    0
               4             102       197    2312      762   4     232   672   34



       •



2011   3   5
Index

       • WHERE                             Index     Primary Key

       WHERE user_id = 10001

       → user_id    Index(        Primary Key)

       WHERE user_id = 10001 AND friend_id = 10002

       → (user_id, friend_id)

       WHERE visiting_id = 10001 AND visited_id IN (1,2,3) AND action=2

       → (visiting_id,visited_id,action)

       WHERE status = 2 ORDER BY start_time

       → (status,start_time)


2011   3   5
Index

       •                  Index

       WHERE start_time < 12345678 AND state = 2

       →(start_time,state)                                    (state,start_time)

       • Index

       WHERE visited_id = 10002 AND visiting_id = 10001 AND action=2

       → (visiting_id,visited_id,action)


       •                             Index

       WHERE visiting_id = 10001 AND action = 2 AND visited_id = 10002

       → (visiting_id,visited_id,action)     Index   visiting_id


2011   3   5
Covering Index

       •

           MySQL                                         Covering Index   - ( ∀ )o   sasata299's blog
           http://blog.livedoor.jp/sasata299/archives/51336006.html



       •
                 Covering Index
           →




2011   3   5
Primary Key                                                 id

       •             Primary Key
           →                     Primary Key                    MySQL               id
           Primary Key
           MySQL :: MySQL 5.1                          :: 13.5.13 InnoDB
           http://dev.mysql.com/doc/refman/5.1/ja/innodb-table-and-index.html


       •        id              WHERE id IN (a,b,c,d...)


       •        id
                                              id
                                    Primary Key                                 (        Covering
           Index          )



2011   3   5
Primary Key

       •                                                   id        Primary Key
                                                                     1


                                             Primary Key


       •                                                        id


       •              id   Primary Key
           (“WHERE user_id=10001”        )




2011   3   5
auto_increment

       •


           ID

               CREATE TABLE seq_history(
                  seq_id bigint unsigned not null
               );

       • auto_increment
           MySQL5.1                                 DB
                 auto_increment




2011   3   5
Read       Write

       • Read(SELECT)       DB
               Write       DB              DB



       •           Write         SELECT



       •                          SELECT




       •                          Read
                                            Write

2011   3   5
•       Read/Write   SQL




       •
                                  IO




           →
           →




2011   3   5
MySQL

       •       DB                                                                   DB
                                         DB


                                   DB                                                    DB



                                                                     (3)Relay Log
                (1)           (INSERT,UPDATE   )
                                                                         SQL
                      Binary Log

                                                                       SQL
                                                    IO
                Binary Log
                                                                               Relay Log
                                                   (2)IO    Binary
                                                   Log
                                                       DB




2011   3   5
DB

       •        DB                  DB
           →MySQL         1


       •




           →                  SSD        cf.




2011   3   5
•
                           NG

       UPDATE history_tbl SET state = 2 WHERE state = 1 LIMIT 10

       →state=1



       UPDATE history_tbl SET state = 2 ORDER BY finish_time LIMIT 1

       →                  finish_time



       • UPDATE        WHERE      Primary Key




2011   3   5

More Related Content

More from Naoyuki Yamada

KubernetesでRedisを使うときの選択肢
KubernetesでRedisを使うときの選択肢KubernetesでRedisを使うときの選択肢
KubernetesでRedisを使うときの選択肢Naoyuki Yamada
 
いわき情報技術研究会20170513
いわき情報技術研究会20170513いわき情報技術研究会20170513
いわき情報技術研究会20170513Naoyuki Yamada
 
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみNaoyuki Yamada
 
東北Tech道場郡山20151031
東北Tech道場郡山20151031東北Tech道場郡山20151031
東北Tech道場郡山20151031Naoyuki Yamada
 
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介Naoyuki Yamada
 
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析Naoyuki Yamada
 
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social Graph
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social GraphCAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social Graph
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social GraphNaoyuki Yamada
 
Adtech College#7 GitHubを中心とした開発フロー
Adtech College#7 GitHubを中心とした開発フローAdtech College#7 GitHubを中心とした開発フロー
Adtech College#7 GitHubを中心とした開発フローNaoyuki Yamada
 
ElasticSearch勉強会 第6回
ElasticSearch勉強会 第6回ElasticSearch勉強会 第6回
ElasticSearch勉強会 第6回Naoyuki Yamada
 
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale Datasets
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale DatasetsCAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale Datasets
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale DatasetsNaoyuki Yamada
 
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへ
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへADTECH COLLEGE #2 近い将来、開発責任者になるあなたへ
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへNaoyuki Yamada
 
株式会社サイバーエージェント アドテクスタジオの技術と開発
株式会社サイバーエージェント アドテクスタジオの技術と開発株式会社サイバーエージェント アドテクスタジオの技術と開発
株式会社サイバーエージェント アドテクスタジオの技術と開発Naoyuki Yamada
 
Functional Programming in Scala Reading #2
Functional Programming in Scala Reading #2Functional Programming in Scala Reading #2
Functional Programming in Scala Reading #2Naoyuki Yamada
 
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまで
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまでCode for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまで
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまでNaoyuki Yamada
 
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作る
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作るJAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作る
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作るNaoyuki Yamada
 
データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回Naoyuki Yamada
 
Social Web Japan Vol.3 "Social Application and their support services"
Social Web Japan Vol.3 "Social Application and their support services"Social Web Japan Vol.3 "Social Application and their support services"
Social Web Japan Vol.3 "Social Application and their support services"Naoyuki Yamada
 
ソーシャルアプリ業界を構成する中間サービスたち
ソーシャルアプリ業界を構成する中間サービスたちソーシャルアプリ業界を構成する中間サービスたち
ソーシャルアプリ業界を構成する中間サービスたちNaoyuki Yamada
 

More from Naoyuki Yamada (18)

KubernetesでRedisを使うときの選択肢
KubernetesでRedisを使うときの選択肢KubernetesでRedisを使うときの選択肢
KubernetesでRedisを使うときの選択肢
 
いわき情報技術研究会20170513
いわき情報技術研究会20170513いわき情報技術研究会20170513
いわき情報技術研究会20170513
 
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
 
東北Tech道場郡山20151031
東北Tech道場郡山20151031東北Tech道場郡山20151031
東北Tech道場郡山20151031
 
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介
AWSからOpenStack, Chef SoloからChef Serverに インフラを置き換えた事例の紹介
 
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析
Elasticsearch勉強会第8回 ElasticsearchとKibanaで実現する 30億req/dayのリアルタイム分析
 
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social Graph
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social GraphCAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social Graph
CAジャーナルクラブ TAO: Facebook’s Distributed Data Store for the Social Graph
 
Adtech College#7 GitHubを中心とした開発フロー
Adtech College#7 GitHubを中心とした開発フローAdtech College#7 GitHubを中心とした開発フロー
Adtech College#7 GitHubを中心とした開発フロー
 
ElasticSearch勉強会 第6回
ElasticSearch勉強会 第6回ElasticSearch勉強会 第6回
ElasticSearch勉強会 第6回
 
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale Datasets
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale DatasetsCAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale Datasets
CAジャーナルクラブ Dremel: Interactive Analysis of Web-Scale Datasets
 
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへ
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへADTECH COLLEGE #2 近い将来、開発責任者になるあなたへ
ADTECH COLLEGE #2 近い将来、開発責任者になるあなたへ
 
株式会社サイバーエージェント アドテクスタジオの技術と開発
株式会社サイバーエージェント アドテクスタジオの技術と開発株式会社サイバーエージェント アドテクスタジオの技術と開発
株式会社サイバーエージェント アドテクスタジオの技術と開発
 
Functional Programming in Scala Reading #2
Functional Programming in Scala Reading #2Functional Programming in Scala Reading #2
Functional Programming in Scala Reading #2
 
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまで
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまでCode for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまで
Code for Japan 勉強会 Vol.1 CKAN入門 プロジェクトのFork、デプロイ、CIまで
 
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作る
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作るJAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作る
JAWS-2013-LT 10000req/secを50msecで返すサーバーインフラをAWSで作る
 
データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回
 
Social Web Japan Vol.3 "Social Application and their support services"
Social Web Japan Vol.3 "Social Application and their support services"Social Web Japan Vol.3 "Social Application and their support services"
Social Web Japan Vol.3 "Social Application and their support services"
 
ソーシャルアプリ業界を構成する中間サービスたち
ソーシャルアプリ業界を構成する中間サービスたちソーシャルアプリ業界を構成する中間サービスたち
ソーシャルアプリ業界を構成する中間サービスたち
 

Recently uploaded

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101vincent683379
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 

Recently uploaded (20)

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 

社内勉強会:ソーシャルゲームのデータベース設計入門

  • 1. 2011 3 4 2011 3 5
  • 2. DB • Index Index Covering Index Primary Key Read Write • MySQL DB SQL 2011 3 5
  • 3. →(10001,A) ※ • Primary Key →Primary Key • Primary Key 2011 3 5
  • 4. ID ID 1 1 2 2 2 2011 3 5
  • 5. ID ID 1 10001 1 10002 2 10001 ID ID 1 10001 2 10002 1 10002 2 10001 2 10002 ID 10001 10002 2011 3 5
  • 6. ID ID 1 101 2 102 ID ID 3 103 1 101 4 102 2 102 3 103 4 102 ID 101 102 103 2011 3 5
  • 7. ALTER TABLE • • (ALTER TABLE) →ALTER TABLE • • → 2011 3 5
  • 8. ID ID 1 1 101 1 1 2 234 2 1 3 553 3 1 4 232 4 2 1 102 2 2 271 2 3 952 ID 1 101 234 553 232 873 0 102 0 2 102 271 8652 98 0 234 202 0 3 103 952 76 765 872 45 0 0 4 102 197 2312 762 4 232 672 34 • 2011 3 5
  • 9. Index • WHERE Index Primary Key WHERE user_id = 10001 → user_id Index( Primary Key) WHERE user_id = 10001 AND friend_id = 10002 → (user_id, friend_id) WHERE visiting_id = 10001 AND visited_id IN (1,2,3) AND action=2 → (visiting_id,visited_id,action) WHERE status = 2 ORDER BY start_time → (status,start_time) 2011 3 5
  • 10. Index • Index WHERE start_time < 12345678 AND state = 2 →(start_time,state) (state,start_time) • Index WHERE visited_id = 10002 AND visiting_id = 10001 AND action=2 → (visiting_id,visited_id,action) • Index WHERE visiting_id = 10001 AND action = 2 AND visited_id = 10002 → (visiting_id,visited_id,action) Index visiting_id 2011 3 5
  • 11. Covering Index • MySQL Covering Index - ( ∀ )o sasata299's blog http://blog.livedoor.jp/sasata299/archives/51336006.html • Covering Index → 2011 3 5
  • 12. Primary Key id • Primary Key → Primary Key MySQL id Primary Key MySQL :: MySQL 5.1 :: 13.5.13 InnoDB http://dev.mysql.com/doc/refman/5.1/ja/innodb-table-and-index.html • id WHERE id IN (a,b,c,d...) • id id Primary Key ( Covering Index ) 2011 3 5
  • 13. Primary Key • id Primary Key 1 Primary Key • id • id Primary Key (“WHERE user_id=10001” ) 2011 3 5
  • 14. auto_increment • ID CREATE TABLE seq_history( seq_id bigint unsigned not null ); • auto_increment MySQL5.1 DB auto_increment 2011 3 5
  • 15. Read Write • Read(SELECT) DB Write DB DB • Write SELECT • SELECT • Read Write 2011 3 5
  • 16. Read/Write SQL • IO → → 2011 3 5
  • 17. MySQL • DB DB DB DB DB (3)Relay Log (1) (INSERT,UPDATE ) SQL Binary Log SQL IO Binary Log Relay Log (2)IO Binary Log DB 2011 3 5
  • 18. DB • DB DB →MySQL 1 • → SSD cf. 2011 3 5
  • 19. NG UPDATE history_tbl SET state = 2 WHERE state = 1 LIMIT 10 →state=1 UPDATE history_tbl SET state = 2 ORDER BY finish_time LIMIT 1 → finish_time • UPDATE WHERE Primary Key 2011 3 5