SlideShare a Scribd company logo
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
いわき情報技術研究会20170513
Naoyuki Yamada
 
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
浪江町タブレットで採用した、 Cordovaで作るHTML5のAndroidアプリのしくみ
Naoyuki Yamada
 
東北Tech道場郡山20151031
東北Tech道場郡山20151031東北Tech道場郡山20151031
東北Tech道場郡山20151031
Naoyuki 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 Graph
Naoyuki 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 Datasets
Naoyuki 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

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

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

  • 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