欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

postgreSQL數(shù)據(jù)庫 實(shí)現(xiàn)向表中快速插入1000000條數(shù)據(jù)

 更新時(shí)間:2020年12月30日 08:51:19   作者:password-u  
這篇文章主要介紹了postgreSQL數(shù)據(jù)庫 實(shí)現(xiàn)向表中快速插入1000000條數(shù)據(jù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

不用創(chuàng)建函數(shù),直接向表中快速插入1000000條數(shù)據(jù)

create table tbl_test (id int, info text, c_time timestamp);
insert into tbl_test select generate_series(1,100000),md5(random()::text),clock_timestamp();
select count(id) from tbl_test; --查看個(gè)數(shù)據(jù)條數(shù)

補(bǔ)充:postgreSQL 批量插入10000條數(shù)據(jù) ,生成隨機(jī)字母隨機(jī)數(shù)

啥也不說了,看代碼吧~

--隨機(jī)字母 
select chr(int4(random()*26)+65);

--隨機(jī)4位字母
select repeat( chr(int4(random()*26)+65),4);

--隨機(jī)數(shù)字 十位不超過6的兩位數(shù)
select (random()*(6^2))::integer;

--三位數(shù)
select (random()*(10^3))::integer;

insert into t_test SELECT generate_series(1,10000) as key,repeat( chr(int4(random()*26)+65),4), (random()*(6^2))::integer,null,(random()*(10^4))::integer;

10000條數(shù)據(jù)完成,開始測(cè)試吧

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教。

相關(guān)文章

最新評(píng)論