Host Arrays – performance gain[通俗易懂]

Host Arrays – performance gain[通俗易懂]To achieve a better performance in Pro*C/C++ application, using host arrays would be efficient than

Host Arrays - performance gain

To achieve a better performance in Pro*C/C++ application, using host arrays would be efficient than the usage of the simple host variables during the data insert. This document is about to detail how much runtime savings we gain from using the host arrays when inserting data into an Oracle database table.

 

When using simple host variables to insert data, data inserting is one row based. For example, we have below SQL insert statement, and 4,500 rows to be inserted into the table EMP. During the execution, the SQL statement would be executing 4,500 times; one row at a time.

insert into table emp(empno, ename, sal) values(:hv1,:hv2,:hv3);

 

However, when an array of 4,500 members is declared and the data is stored in the host array, the database would consider a batch of data insert during the runtime, which is the 4,500 rows inserted would be treated as one transaction.

 

A Pro*C/C++ program is built to run the tests. Some elements of the program are as follows:

A C structure – Host array to hold all 4,500 data rows.

A timer – to calculate the time elapsed.

The program executes on a client workstation, which may test network round trips.

Enough table segments space provided, which does not need table to extent segments during the runtime.

Table EMP:

Name Null? Type

—————– ——– ————

EMPNO NOT NULL NUMBER(4)

ENAME VARCHAR2(20)

SAL NUMBER(7,2)

 

The program total run 7 times, each time, truncate table emp is used. below are the data collected.

 #1:

The total time of the LoopIns program execution = 1.609458

The total time of the ArrayHost program execution = 0.008854

Result: 99.450% saved.

 

#2:

The total time of the LoopIns program execution = 1.587075

The total time of the ArrayHost program execution = 0.008567

Result: 99.460% saved.

 

#3:

The total time of the LoopIns program execution = 1.531888

The total time of the ArrayHost program execution = 0.008677

Result: 99.434% saved.

 

#4:

The total time of the LoopIns program execution = 1.614283

The total time of the ArrayHost program execution = 0.008676

Result: 99.463% saved.

 

#5:

The total time of the LoopIns program execution = 1.564746

The total time of the ArrayHost program execution = 0.008582

Result: 99.452% saved.

 

#6:

The total time of the LoopIns program execution = 1.531173

The total time of the ArrayHost program execution = 0.008060

Result: 99.474 saved.

 

#7:

The total time of the LoopIns program execution = 1.461805

The total time of the ArrayHost program execution = 0.008107

Result: 99.445% saved.

 

On average, 99.454% runtime savings are achieved by using the host arrays to insert 4,500 rows of data into the database table. Therefore, based on above testing data, using host arrays do provide a better performance gain during the data processing.

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/6972.html

(0)
上一篇 2023-03-29
下一篇 2023-03-30

相关推荐

  • 微服务+分布式再上一“城”,腾讯云数据库TDSQL助力海峡银行新一代核心系统上线[通俗易懂]

    微服务+分布式再上一“城”,腾讯云数据库TDSQL助力海峡银行新一代核心系统上线[通俗易懂]日前,福建海峡银行新一代核心业务系统正式上线,关键业务系统采用“微服务+分布式”架构,顺利完成数据库国产化替换。 新核心改造历时14个月,依托腾讯云企业级分布式数据库TDSQL良好的兼容性、成熟的迁移

    2023-05-25
    155
  • Python仓库

    Python仓库Python是当下最为流行的编程语言之一,它简单易学,语法简洁明了,拥有丰富的标准库和第三方库,受到大量程序员的喜爱。在Python的生态系统中,Python仓库是一个重要的组成部分。本篇文章将详细介绍Python仓库的相关内容,包括Python仓库的定义、作用、使用方法等,有助于读者深入了解Python仓库的知识。

    2024-08-10
    30
  • MySQL Integer类型与INT(11)「终于解决」

    MySQL Integer类型与INT(11)「终于解决」1.介绍 Integer类型,即整数类型,MySQL支持的整数类型有TINYINT、SMALLINT、MEDIUMINT、INT、BIGINT。 1.1 空间和范围 每种整数类型所需的存储空间和范围如

    2023-02-06
    166
  • web项目踩坑过程[通俗易懂]

    web项目踩坑过程[通俗易懂]sql函数设计: 一开始本来是直接用Java的jdbc直接传输操作语句的。但后来学了存储过程发现存储过程可以提高不少的效率。就重构了自己对数据库的操作代码。包括:开启,查找,修改,关闭。 开启:直接使

    2022-12-22
    149
  • sql数据库创建用户并授权_无法创建新的数据库,权限被拒绝

    sql数据库创建用户并授权_无法创建新的数据库,权限被拒绝先以root用户登录mysql: C:UsersXXX>mysql -u root -p 输入密码后登录,接下来操作如下: 1、创建数据库 语法:create schema [数据库名称] defa…

    2023-02-13
    149
  • 环球易购数据平台如何做到既提速又省钱?[亲测有效]

    环球易购数据平台如何做到既提速又省钱?[亲测有效]背景简介 环球易购创建于 2007 年,致力于打造惠通全球的 B2C 跨境电商新零售生态,2014 年通过与百圆裤业并购完成上市,上市公司「跨境通(SZ002640)」是 A 股上市跨境电商第一股。经

    2023-04-27
    141
  • 使用Python绘制地图

    使用Python绘制地图地图是人类为了更好的认知和探索世界而发明的。如今,随着时代的进步和技术的发展,我们可以使用各种工具来制作和展示地图。Python是一种强大的编程语言,提供了各种绘制地图的工具和库,方便了地图制作和分析。

    2024-08-11
    35
  • Mysql5.7 Linux安装教程

    Mysql5.7 Linux安装教程1系统约定 安装文件下载目录:/data/software Mysql目录安装位置:/usr/local/mysql 数据库保存位置:/data/mysql 日志保存位置:/data/log/mys…

    2023-04-13
    135

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注