48
得分享 Modern Web 2016 技術在我們上, 票就在我們上 2016 10 8 JAAD - Win

ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)

  • Upload
    win-yu

  • View
    107

  • Download
    5

Embed Size (px)

Citation preview

  • Modern Web 2016

    2016 10 8 JAAD - Win

  • MySQL

    Modern Web 2016 Ant_ModernWeb-MySQL_.pdf

  • Donald Knuth-

    Modern Web 2016 3

  • Modern Web 2016 4

  • Modern Web 2016 5

  • Modern Web 2016 6

  • Minimum Viable Product

    MVP ....

    Modern Web 2016 7

  • MVP

    Modern Web 2016 8

  • Modern Web 2016

    Research Development

    9

  • Modern Web 2016 10

  • Modern Web 2016 11

  • ...

    Modern Web 2016 12

  • Modern Web 2016 13

  • Modern Web 2016

    Monolithic Microservices

    14

  • Elastic Business

    Modern Web 2016

  • Modern Web 2016

    ()

    16

  • Modern Web 2016 17

  • Modern Web 2016 18

  • Modern Web 2016

    19

  • Modern Web 2016 20

  • Modern Web 2016

    {0: deleted, 1: enabled, 2: locaked}

    21

  • Modern Web 2016 22

  • Modern Web 2016

    SELECT * FROM {Table} WHERE tag1 = `admin`

    23

  • Modern Web 2016

    SELECT * FROM {Table} WHERE tag1 = `admin`

    24

  • Modern Web 2016

    SELECT * FROM {Table} WHERE (tag1 = `admin` OR tag2 = `admin` OR tag3 = `admin`) AND (tag1 = `reporter` OR tag2 = `reporter` OR tag3 = `reporter`)

    SELECT * FROM {Table} WHERE `admin` IN (tag1, tag2, tag3) AND `reporter` IN (tag1, tag2, tag3)

    alter table !!

    25

  • Modern Web 2016

    SELECT * FROM {Table} INNER JOIN `Tag` AS t1 USING (id) INNER JOIN `Tag` AS t2 USING (id) WHERE t1.tag = `admin AND t2.tag = `reporter`

    1

    tag

    26

  • Modern Web 2016

    2

    M : N

    27

  • Modern Web 2016 28

  • Scale Up- Application

    Modern Web 2016

  • N+1 queries / ORM Bad SQL Bad Schema Design Big SQL Big Transaction Big Batch

    99% Application

    Modern Web 2016 30

  • N+1 queries / ORM Bad SQL Bad Schema Design Big SQL Big Transaction Big Batch

    99% Application

    Modern Web 2016 31

  • CHAR MySQL 5.7.7 CHAR VARCHAR

    Modern Web 2016

    (MySQL) CHAR vs. VARCHAR

    32

  • Primary Index MySQL Index Composite Index

    Modern Web 2016

    Index

    33

  • Modern Web 2016

    Scale Out- Replication- Cluster

  • Modern Web 2016

    Replication

    35

  • Modern Web 2016

    Replication

    Read Write

    36

  • Modern Web 2016

    Clustering

    Read/Write

    37

  • Modern Web 2016

    Clustering

    : Deadlock

    38

  • Modern Web 2016

    Clustering

    Load Balancer 39

  • Percona XtraDB Cluster: Multi-node writing and Unexpected deadlocks2012-08-17 https://www.percona.com/blog/2012/08/17/percona-xtradb-cluster-multi-node-writing-and-unexpected-deadlocks/

    Avoiding Deadlocks in Galera - Set up HAProxy for single-node writes and multi-node reads2013-09-17 http://www.severalnines.com/blog/avoiding-deadlocks-galera-set-haproxy-single-node-writes-and-multi-node-reads

    Optimizing Percona XtraDB Cluster for write hotspots2015-06-03 https://www.percona.com/blog/2015/06/03/optimizing-percona-xtradb-cluster-write-hotspots/

    Modern Web 2016 40

    https://www.percona.com/blog/2012/08/17/percona-xtradb-cluster-multi-node-writing-and-unexpected-deadlocks/https://www.percona.com/blog/2012/08/17/percona-xtradb-cluster-multi-node-writing-and-unexpected-deadlocks/http://www.severalnines.com/blog/avoiding-deadlocks-galera-set-haproxy-single-node-writes-and-multi-node-readshttp://www.severalnines.com/blog/avoiding-deadlocks-galera-set-haproxy-single-node-writes-and-multi-node-reads

  • Clustering Database Federation

    Table Partitioning Table Sharding

    Modern Web 2016 41

  • Modern Web 2016

    How to do in PIXNET

  • Modern Web 2016

    43

  • Modern Web 2016

    Thank you.