分类:见Visio图
关于大量数据导入是应注意以下几点:
分批导入,导入一批后最后提交(commit),可以使用jdbc的(executeBatch)批量处理但是注意它的最大上限,否则只会执行一部分sql语句,超过上限的sql会自动丢弃;
注意内存使用(不要出现内存益出, Java heap space;
尽量使用大量导入工具(bcp,sqlLoader)来完成(未测试不确定) ;
数据量很大时导入时最好不要做太多的判断,这样会影响导入速度;
数据量很大时:是在建表时候添加主键(假设主键不是自增长ID列)后插入数据,还是插入数据后添加主键,前者主要的问题是大量数据插入速度减慢,如果是频繁的插入操作会导致数据库奔溃;后者的问题也是大量数据的表添加主键(需要删除重复记录,并根据mysql自己的添加主键机制来处理,速度很慢,而且频繁的操作也会导致数据库的奔溃);
如果原数据表中有索引,先删除索引,待到导入数据后再建立索引;(主键是唯一索引的特列,这也是 5.中所述的)
由于数据量大的原因,需要配置mysql的my.ini 文件中相关选项,这个过程中如果不是很明白各个参数之间的相关关系,则需要一个参数一个参数的修改,从而提高mysql的整体性能;
insert 语句的处理而言,用StringBuilder代替“+”其性能是个质的提高;
利用jdbc支持的批量插入(preparedstatement),手动控制事务(将插入的数据分割为多次提交),从而此番优化的程序可达到多线讲程并发高效插入的时效;
使用create table select *from soucre.table 方式建表和show create table tablename方式建表是不相同的,后者建立的表是和原来的表source.table 结构相同的,但是前者的建表方式得到的表结构是没有主键的;

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
