在測(cè)試的時(shí)候?yàn)榱藴y(cè)試大數(shù)據(jù)量的情況下項(xiàng)目的抗壓能力我們通常要?jiǎng)?chuàng)造一些測(cè)試數(shù)據(jù)那么現(xiàn)在這個(gè)方法絕對(duì)好用
其中可能會(huì)有sql空間的報(bào)錯(cuò)可以自己嘗試解決,這里做了分批插入,每次插入30萬(wàn)條,所以沒(méi)有遇到類似的空間問(wèn)題
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sdb_b2c_orders
-- ----------------------------
DROP TABLE IF EXISTS `sdb_b2c_orders`;
CREATE TABLE `sdb_b2c_orders` (
`order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '訂單號(hào)',
`seller_order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '商戶訂單號(hào)',
`total_amount` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '商品默認(rèn)貨幣總值',
`final_amount` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單貨幣總值, 包含支付價(jià)格,稅等',
`pay_status` enum('0','1','2','3','4','5') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '付款狀態(tài) 0-未支付 1-已支付 2-已付款至擔(dān)保方 3-部分付款 4-部分退款 5-全額退款',
`ship_status` enum('0','1','2','3','4') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '發(fā)貨狀態(tài)',
`is_delivery` enum('Y','N') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Y' COMMENT '是否需要發(fā)貨',
`createtime` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '下單時(shí)間',
`last_modified` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后更新時(shí)間',
`ectools_payments` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`payment` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支付方式',
`shipping_id` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '配送方式',
`shipping` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配送方式',
`member_id` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '會(huì)員用戶名',
`platform_member_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '平臺(tái)會(huì)員ID',
`store_id` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '收款門店ID',
`confirm_status` enum('0','1','2','3') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '門店接單狀態(tài)',
`confirm_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '接單時(shí)間',
`pickself_status` enum('0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自提狀態(tài)',
`pickself_time` int(10) NULL DEFAULT NULL COMMENT '自提時(shí)間',
`pickself_id` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '自提門店ID',
`operator_id` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '收款用戶ID',
`weixinscan_qrcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信付款碼',
`alipay_qrcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支付寶付款碼',
`unionpay_qrcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '銀聯(lián)付款碼',
`qrcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '核銷碼',
`promotion_type` enum('normal','prepare','recharge','cashier') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'normal' COMMENT '銷售類型',
`status` enum('active','dead','finish') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'active' COMMENT '訂單狀態(tài)',
`confirm` enum('Y','N') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'N' COMMENT '確認(rèn)狀態(tài)',
`ship_area` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨地區(qū)',
`ship_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨人',
`weight` decimal(20, 3) NULL DEFAULT NULL COMMENT '訂單總重量',
`tostr` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '訂單文字描述',
`itemnum` mediumint(8) UNSIGNED NULL DEFAULT NULL COMMENT '訂單子訂單數(shù)量',
`ip` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'IP地址',
`ship_addr` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '收貨地址',
`ship_zip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨人郵編',
`ship_tel` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨電話',
`ship_email` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨人email',
`ship_time` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配送時(shí)間',
`ship_mobile` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收貨人手機(jī)',
`cost_item` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單商品總價(jià)格',
`is_tax` enum('true','false') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'false' COMMENT '是否要開(kāi)發(fā)票',
`tax_type` enum('false','personal','company') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'false' COMMENT '發(fā)票類型',
`tax_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '發(fā)票內(nèi)容',
`cost_tax` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單稅率',
`tax_company` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '發(fā)票抬頭',
`is_protect` enum('true','false') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'false' COMMENT '是否還有保價(jià)費(fèi)',
`cost_protect` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '保價(jià)費(fèi)',
`cost_payment` decimal(20, 3) NULL DEFAULT NULL COMMENT '支付費(fèi)用',
`currency` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '訂單支付貨幣',
`cur_rate` decimal(10, 4) NULL DEFAULT 1.0000 COMMENT '訂單支付貨幣匯率',
`score_u` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單使用積分',
`score_g` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單獲得積分',
`discount` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '訂單減免',
`pmt_goods` decimal(20, 3) NULL DEFAULT NULL COMMENT '商品促銷優(yōu)惠',
`pmt_order` decimal(20, 3) NULL DEFAULT NULL COMMENT '訂單促銷優(yōu)惠',
`payed` decimal(20, 3) NULL DEFAULT 0.000 COMMENT '訂單支付金額',
`memo` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '訂單附言',
`disabled` enum('true','false') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'false',
`displayonsite` enum('true','false') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'true',
`mark_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'b1' COMMENT '訂單備注圖標(biāo)',
`mark_text` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '訂單備注',
`cost_freight` decimal(20, 3) NOT NULL DEFAULT 0.000 COMMENT '配送費(fèi)用',
`extend` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'false' COMMENT '訂單擴(kuò)展',
`order_refer` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'local' COMMENT '訂單來(lái)源',
`addon` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '訂單附屬信息(序列化)',
`source` enum('pc','wap','weixin','cashier','paycode','eleme','meituan') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'pc' COMMENT '平臺(tái)來(lái)源',
`source_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商圈庫(kù)名',
`merchant_bn` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商戶號(hào)',
UNIQUE INDEX `idx_bn`(`order_id`, `merchant_bn`) USING BTREE,
INDEX `ind_ship_status`(`ship_status`) USING BTREE,
INDEX `ind_pay_status`(`pay_status`) USING BTREE,
INDEX `ind_promotion_type`(`promotion_type`) USING BTREE,
INDEX `ind_status`(`status`) USING BTREE,
INDEX `ind_disabled`(`disabled`) USING BTREE,
INDEX `ind_last_modified`(`last_modified`) USING BTREE,
INDEX `ind_createtime`(`createtime`) USING BTREE,
INDEX `idx_order_refer`(`order_refer`) USING BTREE,
INDEX `idx_bn_aa`(`merchant_bn`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '訂單表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
百萬(wàn)數(shù)據(jù)搞定,到此這篇關(guān)于MySQL如何利用存儲(chǔ)過(guò)程快速生成100萬(wàn)條數(shù)據(jù)的文章就介紹到這了,更多相關(guān)MySQL用存儲(chǔ)過(guò)程生成100萬(wàn)數(shù)據(jù)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!