zoukankan      html  css  js  c++  java
  • postgres 使用存储过程批量插入数据

    參考资料(pl/pgsql 官方文档): http://www.postgresql.org/docs/9.3/static/plpgsql.html



    create or replace function creatData2() returns 
    boolean AS
    $BODY$
    declare ii integer;
      begin
      II:=1;
      FOR ii IN 1..10000000 LOOP
      INSERT INTO ipm_model_history_data (res_model, res_id) VALUES (116, ii);
      end loop;
      return true;
      end;
    $BODY$
    LANGUAGE plpgsql;
    select * from creatData2() as tab;


    插入1千万条数据耗时610s。当然字段不多的情况下。

查看全文
  • 相关阅读:
    关于多态的一些问题
    003 关于shell基础,大数据的前期准备
    002 在大数据中基础的llinux基本命令
    013 MapReduce八股文的wordcount应用
    接口里语句的修饰问题
    Apache Rewrite url重定向功能的简单配置
    学习笔记 --- 缓存、动态页面静态化、网站优化
    使用PHP连接、操纵Memcached的原理和教程
    Apache中关于页面缓存的设置
    缓存(之一) 使用Apache Httpd实现http缓存
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10935006.html
  • Copyright © 2011-2022 走看看