ITPub博客

首页 > 数据库 > Oracle > 如何随机生成一个大表的数据

如何随机生成一个大表的数据

原创 Oracle 作者:huangdazhu 时间:2017-04-17 16:10:00 0 删除 编辑
create table test_table(a number,b varchar2(100),c varchar2(10),d date);
insert into test_table
select rownum as a,
       dbms_random.string('a', 50),
       dbms_random.string('u', 3) as c,
       to_date('2016-01-01', 'yyyy-mm-dd') + dbms_random.value * 360 as d
  from dual
connect by level <= 4000000;  
commit;


创建索引:
create index idx_node_c_a on test_table(c,a);
create index idx_node_c on test_table(c);
create index uk_node on test_table(a);

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28869493/viewspace-2137418/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-05-08

  • 博文量
    178
  • 访问量
    463078