C++20 镶 SQL
C++20 ❤ SQL John R Bandela, MDOverview u SQL u C++ Example u Implementation techniques u fixed_string u meta_struct u Parsing compile time strings into meta_structsOverview v SQL v C++ Example {price_from_user};Avoiding SQL Injection Attacks SELECT orders.id, name, item, price, discount_code FROM orders JOIN customers ON customers.id = customerid WHERE price > ?;SQL Library Options u Traditional Lots of information available u Vulnerable to sql injection of developer not careful u Use dynamic typingDomain Specific Language u Use types to encode SQL u Looks more like regular C++ u Typically requires0 码力 | 46 页 | 775.02 KB | 5 月前3TiDB中文技术文档
TiDB 数据库管理 TiDB 服务 TiDB 进程启动参数 TiDB 系统数据库 TiDB 系统变量 TiDB 专用系统变量和语法 TiDB 访问权限管理 TiDB 用户账户管理 使用加密连接 SQL 优化 理解 TiDB 执行计划 统计信息 语言结构 字面值 数据库、表、索引、列和别名 关键字和保留字 用户变量 表达式语法 注释语法 字符集和时区 字符集支持 字符集配置 时区 数据类型 日期和时间类型 日期和时间函数 位函数和操作符 Cast 函数和操作符 加密和压缩函数 信息函数 JSON 函数 GROUP BY 聚合函数 其他函数 精度数学 SQL 语句语法 数据定义语句 (DDL) 数据操作语句 (DML) 事务语句 数据库管理语句 Prepared SQL 语句语法 实用工具语句 JSON 支持 Connectors 和 API TiDB 事务隔离级别 错误码与故障诊断 与 MySQL 兼容性对比 TiDB 进程启动参数 TiDB 数据目录 TiDB 系统数据库 TiDB 系统变量 TiDB 专用系统变量和语法 TiDB 服务器日志文件 TiDB 访问权限管理 TiDB 用户账户管理 使用加密连接 SQL 优化 理解 TiDB 执行计划 统计信息 语言结构 字面值 数据库、表、索引、列和别名 关键字和保留字 用户变量 表达式语法 注释语法 字符集和时区 字符集支持 字符集配置 时区 数据类型 数值类型0 码力 | 444 页 | 4.89 MB | 5 月前3分布式NewSQL数据库TiDB
设置为 utf8mb4 的效果是否⼀样 Q10: TiDB 加个联合索引会锁表吗 Q11:TiDB默认时区 Q12:查看TiDB创建索引的过程是否已经结束 Q13:TiDB 最⼤连接数 Q14: SQL执⾏时间突然变⻓ Q15: 如何通过tableID 查找表名 Q16: 如何查看当前版本 ⽬录 分布式NewSQL数据库 TiDB Copyright © 2012-2021 UCloud 优刻得 7/120 Hadoop 体系太复杂,运维、存储成本太⾼⽆法满⾜⽤⼾ 的需求。与 Hadoop 相⽐,TiDB 就简单得多,业务通过 ETL ⼯具或者 TiDB 的同步⼯具将数据同步到 TiDB,在 TiDB 中可通过 SQL 直接⽣成报表 真正⾦融级⾼可⽤ 真正⾦融级⾼可⽤ 相⽐于传统主从 (M-S) 复制⽅案,基于 Raft 的多数派选举协议可以提供⾦融级的 100% 数据强⼀致性保证,且在不丢失⼤多数副本的前提下,可以实现故障的⾃动恢复 Transaction too large TiDB对事务有限制: FAQ 分布式NewSQL数据库 TiDB Copyright © 2012-2021 UCloud 优刻得 115/120 单个事务包含的 SQL 语句不超过 100000 条。每个键值对不超过 6MB,键值对的总⼤⼩不超过 100MB。 Q5: TiDB 是否⽀持 是否⽀持 select for update? ? ⽀持,使⽤悲观锁时与MySQL基本⼀致。0 码力 | 120 页 | 7.42 MB | 5 月前31.2 Go in TiDB
Go in TiDB 申砾@PingCAP Agenda • About Me • What is TiDB • TiDB Architecture • SQL Layer Internal • Golang in TiDB • Next Step of TiDB About Me • Shen Li (申砾) • Tech Lead of TiDB, VP of Engineering Scalable, SQL Database that supports the best features of both traditional RDBMS and NoSQL. Scalability High Availability ACID SQL Architecture - the Whole Picture Architecture - SQL Layer Layer Example - SQL Schema: CREATE TABLE t (c1 INT, c2 VARCHAR(32), INDEX idx1 (c1)); Query: SELECT COUNT(c1) FROM t WHERE c1 > 10 AND c2 = “gopherchina”; Example - Logical Plan SelectStmt Node0 码力 | 27 页 | 935.47 KB | 5 月前3Real-Time Unified Data Layers: A New Era for Scalable Analytics, Search, and AI
across distributed systems. High-performance querying for analytics, search, and AI workloads at scale. SQL simplicity to unify access across divers data types, reducing complexity in querying distributed datasets execute complex queries on very large data sets in the sub-second range. All with the simplicity of SQL. Optimizing for AI & Search is Difficult Optimizing for both structured analytics, full-text search complexity, storage costs, and maintenance overhead by consolidating disparate systems. The native SQL support also makes it simple to use as it provides a single and easy way to query the data. 4. Why0 码力 | 10 页 | 2.82 MB | 5 月前3TiDB and Amazon Aurora
Scalable read Cons: ● Single point write (if you want to scale out writer, you still need sharding) ● SQL layer is not designed for complex query ● Reader is eventual consistency ● Memory size and storage Node TiDB Node TiDB Node Key-Value or Co-processor API calls ... ... ... TiDB servers, stateless, SQL engine PD PD PD MySQL/MariaDB clients, ORMs, JDBC/ODBC, Applications ... MySQL Wire Protocol heartbeat Auto MySQL Compatibility Low High Max Capacity (Good performance) Few TBs 200 TB+ TiDB architecture SQL NoSQL Mapping MySQL wire protocol TiDB Server TiKV Server Storage Physical Stack Highly layered TiKV0 码力 | 57 页 | 2.52 MB | 5 月前3Service Mesh的延伸 — 论道Database Mesh
面向运维服务化之后,数据库怎么办? 服务 • 无状态 • 根据规则路由 • 业务方处理事务 数据库 • 有状态 • 根据SQL路由 • 数据库自动处理事务数据库的进化趋势 • SQL • ACID • 分布式 RDBMS • SQL • BASE ACID • 分布式 NoSQL • SQL • ACID+BASE • 分布式 NewSQLNewSQL的分类 New Architecture Middleware Database-as-a-Service What's Really New with NewSQL?数据库中间层的优势 系统 •事务 运维 • DBA 开发 • SQL数据库中间层应具备的能力 分片化 多副本 数据一致性 弹性化 治理能力 观察能力数据分片 App2 DB App1 App3 App2 DB1 DB2 DB3 App1 App3数据分片:引入中间件 应用方控制并发 高并发 长事务 高并发分布式事务:柔性事务自动化 快照记录 • INSERT • 解析 • 记录 • UPDATE&DELETE • SELECT • 记录 SQL逆向 • INSERT -> DELETE • UPDATE -> UPDATE • DELETE -> INSERT 隔离级别 • 无隔离 • 版本控制 • 记录锁 • 影子表弹性伸缩:数据迁移0 码力 | 35 页 | 4.56 MB | 5 月前3PingCAP TiDB&TiKV Introduction OLTP
间处理;多用于银行、电信等传 统行业复杂业务逻辑场景中,以 Oracle 为代表 • 挑战:成本高,随着数据量增加, 只能通过购买更贵更好的服务器 ;无法线性扩容,海量数据下处 理能力大幅下降 单机关系型(SQL) 分布式非关系型(NoSQL) 分布式关系型(NewSQL) • 背景:随着搜索 / 社交的发展,数 据量爆发增长,传统数据库高成 本,无法线性扩容问题日益突显 ;分布式及 NoSQL 开始快速发 跨数据中心复制 ○ Paxos ● ACID 事务支持 ○ 两阶段提交 ● 无锁快照读 / 无锁只读事务 ○ MVCC ● External Consistency ○ TrueTime API ● SQL 支持 ● the Next BigTable Powered By Jeff Dean 我们在做什么 新一代NewSQL分布式关系型数据库 Ti Project (TiDB + TiKV) ● Applications TiDB ● 开源 F1 实现 ● 无状态的分布式 SQL 层 ● MySQL 协议兼容 ● 针对分布式场景的执行计划,优化器 ○ Push-down / MPP ● Online DDL ○ 业务不中断,进行表结构变更 TiDB 逻辑架构 ● 支持关系型的表结构 ● 全局一致索引 ● 通过 Map-Reduce 或 SQL 并发无锁读 TiDB Server TiDB Worker0 码力 | 21 页 | 613.54 KB | 5 月前3TiDB 2.1.7
TiDB 2.1.7 Kyle Kingsbury 2019-06-12 TiDB is a distributed, auto-sharded SQL database based on Google’s Percolator model. Despite promising snap- shot isolation, TiDB 2.1.7 through 3.0.0-beta.1-40 allowed commit or abort. PingCAP’s database, TiDB, adapts Percolator’s model for use as a general-purpose SQL database. Like Per- colator, it’s comprised of three components: • Placement Driver (PD): allocates coordinates shards • TiKV: a sharded, horizontally-scalable key-value store • TiDB: a transactional SQL layer which stores data in TiKV Placement Driver is replicated via the Raft consensus algorithm for0 码力 | 9 页 | 141.29 KB | 5 月前3TiDB 原理与实战
语言狂热粉 ○ 主要研究方向为分布式系统, 坚信分布式系统才是未来 ● 目前在 PingCAP 就职 ○ 15 年中旬加入 PingCAP ○ 主要参与模块为 TiDB 的 online DDL,SQL 优化器,各种必要的功能改 进以及性能提升 ● 之前在京东就职 ○ 12 年末入职,学习 go 并且开始做云推送项目 ○ 13 年末开始做存储方面的工作,云存储和弹性块存储项目 ● 联系方式 ○ 微博:@紫沐夏_go GitHub:https://github.com/zimulala Agenda ● A brief introduction of NewSQL ● TiDB ● Plan optimization ● Dist SQL ● Online DDL ● TiKV ● Feelings ● Q & A A brief introduction of NewSQL 1970s 2010 2015 Present MySQL 12 120 200 280 789 809 999 Dist SQL 分布式计算 ● 减少计算成本 ● 减少网络开销 Executor DistSQL API TiKV Client Coprocessor Computation Logic API Send requests Computation Dist SQL ● select * from t where age > 20 and0 码力 | 23 页 | 496.41 KB | 5 月前3
共 44 条
- 1
- 2
- 3
- 4
- 5