10 Things Developers Should Know About Databases

2019年7月4日,Peter Zaitsev在伦敦开源数据库会议上的幻灯片
About the Auther
Peter Zaitsev
Peter Zaitsev co-founded Percona and assumed the role of CEO in 2006. As one of the foremost experts on MySQL strategy and optimization, Peter leveraged both his technical vision and entrepreneurial skills to grow Percona from a two-person shop to one of the most respected open source companies in the business. With over 140 professionals in 30 plus countries, Peter’s venture now serves over 3000 customers – including the “who’s who” of internet giants, large enterprises and many exciting startups. Percona was named to the Inc. 5000 in 2013, 2014, 2015 and 2016. Peter was an early employee at MySQL AB, eventually leading the company’s High Performance Group. A serial entrepreneur, Peter co-founded his first startup while attending Moscow State University where he majored in Computer Science. Peter is a co-author of High Performance MySQL: Optimization, Backups, and Replication, one of the most popular books on MySQL performance. Peter frequently speaks as an expert lecturer at MySQL and related conferences, and regularly posts on the Percona Database Performance Blog. He has also been tapped as a contributor to Fortune and DZone, and his recent ebook Practical MySQL Performance Optimization Volume 1 is one of percona.com’s most popular downloads. Peter lives in North Carolina with his wife and two children. In his spare time, Peter enjoys travel and spending time outdoors.


1. 10 Things Developers should know about Databases Peter Zaitsev CEO, Percona 4 July 2019 © 2019 Percona. 1

2.Who Are you ? More More OPS ? Developer ? © 2019 Percona. 2

3.Ops Focused on Database Only Generalist © 2019 Percona. 3

4.Programming Language What Programming Languages does your team use ? © 2019 Percona. 4

5.There is often Tension Devs vs Ops DevOps suppose to have solved it but tension is still common between Devs and Ops Especially with Databases which are often special snowflake Especially with larger organizations © 2019 Percona. 5

6.Large Organizations Ops vs Ops have conflict too © 2019 Percona. 6

7.Devs vs Ops Conflict Devs Ops • Why is this stupid • Why do not learn schema database always the design problem. • Why do not you write • Why can’t it just work and optimized queries work fast • Why do not you think about capacity planning © 2019 Percona. 7

8.Database Responsibility Shared Responsibility for Ultimate Success © 2019 Percona. 8

9.Top Recommendations for Developers © 2019 Percona. 9

10.Learn Database Basics You can’t build great database powered applications if you do not understand how databases work Schema Design Power of the Database Language How Database Executes the Query © 2019 Percona. 10

11.Query Execution Diagram © 2019 Percona. 11

12.EXPLAIN https://dev.mysql.com/doc/refman/8.0/en/execution-plan-information.html © 2019 Percona. 12

13.Which Queries are Causing the Load © 2019 Percona. 13

14.Why Are they Causing this Load © 2019 Percona. 14

15.How to Improve their Performance © 2019 Percona. 15

16.Check out PMM http://pmmdemo.percona.com PMM v 2 Beta 3 is now available © 2019 Percona. 16

17.How are Queries Executed ? Single Threaded Single Node Distributed © 2019 Percona. 17

18.Indexes Indexes are Indexes are Must Expensive © 2019 Percona. 18

19.Capacity Planning No Database can handle “unlimited scale” Scalability is very application dependent Trust Measurements more than Promises Can be done or can be done Efficiently ? © 2019 Percona. 19

20.Vertical and Horizontal Scaling © 2019 Percona. 20

21.Scalable != Efficient The Systems which promote a scalable can be less efficient Hadoop, Cassandra, TiDB are great examples By only the wrong thing you can get in trouble © 2019 Percona. 21

22.TiDB Scalability (Single Node) © 2019 Percona. 22

23.TiDB Efficiency © 2019 Percona. 23

24.Throughput != Latency If I tell you system can do 100.000 queries/sec would you say it is fast ? © 2019 Percona. 24

25.Speed of Light Limitations High Availability Design Choices You want instant durable replication over wide geography or Performance ? Understanding Difference between High Availability and Disaster Recovery protocols Network Bandwidth is not the same as Latency © 2019 Percona. 25

26.Also Understand Connections to the database are expensive Especially if doing TLS Handshake Query Latency Tends to Add Up Especially on real network and not your laptop © 2019 Percona. 26

27.Law of Gravity Shitty Application at scale will bring down any Database © 2019 Percona. 27

28.Scale Matters Developing and Testing with Toy Database is risky Queries Do not slow down linearly The slowest query may slow down most rapidly © 2019 Percona. 28

29.Memory or Disk Data Accessed in memory is much faster than on disk It is true even with modern SSDs SSD accesses data in large blocks, memory does not Fitting data in Working Set © 2019 Percona. 29