当前位置: 首页 > news >正文

Using Set Processing Effectively 有效地使用集合处理

Using Set Processing Effectively 有效地使用集合处理

The information in the topics that follow applies if you are developing new or upgrading older Application Engine programs to adhere to a set-based model.

如果要开发新的应用程序引擎程序或升级旧的应用程序引擎程序以遵循基于集的模型,则以下主题中的信息适用。

SQL Expertise SQL专业知识

You should be a SQL expert if you are developing row-by-row programs with Application Engine and especially if you are developing set-based programs. The following concepts are particularly important:

如果使用应用程序引擎开发逐行程序,尤其是开发基于集合的程序,那么您应该是SQL专家。以下几个概念尤为重要:

  • Group by and Having clauses.
  • group by 和 having 子句。
  • Complex joins.
  • 复杂的联接。
  • Subqueries (correlated and non-correlated).
  • 子查询(相关的和不相关的)。
  • Tools for your database to analyze complex SQL statements for performance analysis.
  • 为您的数据库分析复杂的SQL语句进行性能分析的工具。

Typically, you use these SQL constructs to refine or filter a set to contain only the rows that meet specific criteria. In Application Engine, you code using SQL, and Application Engine passes that SQL directly to the database, where it is processed. If you have a complex SQL statement that works functionally, it may not perform well if it is not tuned properly.

通常,您使用这些SQL构造来优化或筛选一个集合,使其仅包含满足特定条件的行。在应用程序引擎中,使用SQL进行编码,应用程序引擎将该SQL直接传递到数据库,并在数据库中对其进行处理。如果您有一个在功能上工作的复杂SQL语句,如果没有适当地调优,它的性能可能不会很好。

Planning 规划

Well-constructed, robust, and efficient Application Engine programs are usually the product of a detailed planning stage in which loops, program flow, the use of temporary tables, sections, steps, and so on are discussed.

构造良好、健壮且高效的应用程序引擎程序通常是详细规划阶段的产物,在该阶段中讨论了循环、程序流、临时表、节、步骤等的使用。

Ideally, you should address batch processing as a whole while you are designing the system. Sometimes, system analysts and developers focus primarily on the online system during the database design, and then they consider the batch component within the existing database design. Set processing works best in an environment in which data models are optimized for set processing.

理想情况下,您应该在设计系统时将批处理作为一个整体来处理。有时,系统分析师和开发人员在数据库设计过程中主要关注在线系统,然后在现有的数据库设计中考虑批处理组件。集合处理在数据模型为集合处理进行优化的环境中工作得最好。

For example, you could have a separate staging table for new data that has not been processed rather than having numerous cases of existing rows in a table being updated. In set processing, processing the data after moving it to a temporary table using an Insert or Select statement is easier than using an update.

Avoid performing updates on real application tables, and try to perform your updates on temporary tables. You can structure your data model to minimize updating real application tables.

例如,对于尚未处理的新数据,可以使用一个单独的staging表,而不是对表中的现有行进行多次更新。在集合处理中,使用Insert或Select语句将数据移动到临时表后再对其进行处理比使用update更容易。避免在实际应用程序表上执行更新,并尝试在临时表上执行更新。您可以构造数据模型以尽量减少实际应用程序表的更新。

Another important consideration is keeping historical data separate from active transactions. After the life cycle of given piece of transaction data is over, so that no more updates are possible, consider moving that data to an archive or history table and deleting it from the real transaction table. This action minimizes the number of rows in the table, which improves performance for queries and updates to your active data.

另一个重要的考虑是将历史数据与活动事务分开。在给定的事务数据块的生存周期结束之后,因此不再可能进行更新,可以考虑将该数据移动到归档或历史表中,并从实际的事务表中删除它。此操作可最大限度地减少表中的行数,从而提高查询和更新活动数据的性能。

Temporary Tables 临时表

Although temporary tables are not required for set processing, well-designed temporary tables complement your set-based program in a variety of ways.

虽然集合处理不需要临时表,但是设计良好的临时表可以以各种方式补充基于集合的程序。

Creating temporary tables enables you to achieve one of the main objectives of set-based processing: the processing remains on the database server. By storing transient data in temporary tables, you avoid the batch program fetching the data, row by row, and running the business rule, processing the data, and then passing the updated data back to the database. If the program ran on the client, you would encounter performance issues because of the network round-trip and the diminished processing speed of a client compared to the database platform.

创建临时表使您能够实现基于集的处理的主要目标之一:处理保留在数据库服务器上。通过将临时数据存储在临时表中,可以避免批处理程序逐行获取数据、运行业务规则、处理数据,然后将更新的数据传递回数据库。如果程序在客户机上运行,您将遇到性能问题,因为网络往返和与数据库平台相比客户机的处理速度降低。

Design your temporary tables to:

将临时表设计为:

  • Hold transaction data for the current run or iteration of your program.
  • 保存程序当前运行或迭代的事务数据。
  • Contain only those rows of data affected by the business rule.
  • 仅包含受业务规则影响的数据行。
  • Present key information in a denormalized, or flattened, form, which provides the most efficient processing.
  • 以非规范化或扁平化的形式呈现关键信息,这提供了最有效的处理方式。
  • Switch the keys for rows coming from the master tables, if needed.
  • 如果需要,为来自主表的行切换键。

A transaction may use a different key than what appears in the master tables.

事务可以使用与主表中显示的不同的键。

Denormalized Tables 非正规化表

The most efficient temporary tables store data in denormalized form. Because most programs need to access data that resides in multiple tables, you should consolidate all of the affected and related data into one table, a temporary table. The program runs more efficiently against a flattened, temporary table rather than relying on the system to materialize complex joins and views to retrieve or update necessary data for each transaction.

最有效的临时表以非规范化的形式存储数据。因为大多数程序需要访问驻留在多个表中的数据,所以应该将所有受影响的相关数据合并到一个表(临时表)中。程序在一个扁平的临时表上运行的效率更高,而不是依赖于系统来具体化复杂的连接和视图,以便为每个事务检索或更新必要的数据。

If your program requires the use of a complex view to process transactions, then resolve the view into a temporary table for your program to run against. Each join or view that needs to materialize for each transaction consumes system resources and affects performance. In this approach, the system applies the join or view once (during the filtering process), populates the temporary table with the necessary information that the program needs to complete the transaction, and then runs the program against the temporary table as needed.

如果您的程序需要使用复杂的视图来处理事务,那么请将该视图解析为一个临时表,以便程序在其上运行。需要为每个事务实现的每个联接或视图都会消耗系统资源并影响性能。在这种方法中,系统应用一次联接或视图(在过滤过程中),用程序完成事务所需的必要信息填充临时表,然后根据需要对临时表运行程序。

For example, consider the following situation:

例如,考虑下面的情况:

A program needs to update 10,000 rows in the Customer table, which contains 100,000 rows of data. The Customer table is keyed by setID. To complete the transaction, the program references data that resides in a related table called PS_SET_CNTRL_REC. PS_SET_CNTRL_REC is used to associate setID and BUSINESS_UNIT values. The transaction is keyed by BUSINESS_UNIT.

一个程序需要更新Customer表中的10,000行,该表包含100,000行数据。Customer表由setID键控。为了完成事务,程序引用驻留在名为PS_SET_CNTRL_REC的相关表中的数据。PS_SET_CNTRL_REC用于关联setID和BUSINESS_UNIT值。事务由BUSINESS_UNIT键控

Given this set of circumstances, the most efficient processing method would be similar to the following:

考虑到这组情况,最有效的处理方法将类似于以下方法:

  • Isolate affected or necessary data from both tables and insert it into a temporary table.
  • ·从两个表中隔离受影响的或必要的数据,并将其插入到临时表中。

Now, instead of dealing with a 10,000-row Customer table and a join to a related table, the program faces a 10,000-row temporary table that contains all of the required data to join directly to the transaction data, which can also be in a temporary table. If all necessary columns reside in the temporary tables, then the program can modify all the rows at once in a simple Update statement.

现在,程序面对的不是一个10,000行的Customer表和一个到相关表的联接,而是一个10,000行的临时表,其中包含直接联接到事务数据所需的所有数据,这些数据也可以在一个临时表中。如果所有必要的列都驻留在临时表中,那么程序可以在一个简单的Update语句中一次性修改所有行。

This example presents two different uses of temporary tables. In one situation, the temporary table is designed to hold setup and control data in a modified form. In the other situation, the temporary table is designed to hold transaction data in a denormalized form, perhaps with additional work columns to hold intermediate calculations.

本例展示了临时表的两种不同用法。在一种情况下,临时表被设计成以修改后的形式保存设置和控制数据。在另一种情况下,临时表被设计为以非规范化的形式保存事务数据,可能还有额外的工作列来保存中间计算。

  • Make sure the data appears in a denormalized form for optimum processing.
  • 确保数据以非规范化的形式出现,以便进行最佳处理。
  • Because the transaction is keyed by BUSINESS_UNIT, you should also key the temporary table that holds the control data by BUSINESS_UNIT.
  • 因为事务是由BUSINESS_UNIT键控的,所以还应该由BUSINESS_UNIT键控保存控制数据的临时表。

In this case, the table that holds the control data is the Customer table.

在这种情况下,保存控制数据的表是Customer表。

相关文章:

Using Set Processing Effectively 有效地使用集合处理

Using Set Processing Effectively 有效地使用集合处理 The information in the topics that follow applies if you are developing new or upgrading older Application Engine programs to adhere to a set-based model. 如果要开发新的应用程序引擎程序或升级旧的应用程序…...

HarmonyOS开发Java与ArkTS如何抉择

在“鸿蒙系统实战短视频App 从0到1掌握HarmonyOS”视频课程中,很多学员来问我,在HarmonyOS开发过程中,面对Java与ArkTS,应该选哪样? 本文详细分析Java与ArkTS在HarmonyOS开发过程的区别,力求解答学员的一些…...

“茶叶创新:爆改营销策略,三个月狂销2300万“

我的朋友去年制作了一款白茶,并在短短三个月内将其销售量推到了2300万的高峰。你相信吗? 这位朋友并没有任何茶叶方面的经验,他只是一个有着冒险精神的企业家。他先找到了一家代工厂,帮助他把他的茶叶理念转化为现实。 当他把茶叶…...

分享一个生成哈希值的C代码

代码是我在阅读assimp源码时看到的&#xff0c;不依赖任何第三方&#xff0c;可直接集成。 #pragma once #ifndef AI_HASH_H_INCLUDED #define AI_HASH_H_INCLUDED#ifdef __GNUC__ # pragma GCC system_header #endif#include <stdint.h> #include <string.h> #…...

【Windows 常用工具系列 11 -- 福昕PDF搜索高亮过的文本】

文章目录 福昕 PDF 搜索高亮过的文本 福昕 PDF 搜索高亮过的文本 在 pdf 文档阅读过程中&#xff0c;我们需要经常高亮一些文本&#xff0c;以方便下次阅读时找到重点。我这边使用的是 福昕PDF 阅读器&#xff0c;下面就介绍下如何在福昕阅读器中搜索已经高亮过的文本。...

(二)汇编语句组成

一个完整的 RISC-V 汇编程序有多条 语句&#xff08;statement&#xff09; 组成。 一条典型的 RISC-V 汇编 语句 由 3 部分组成&#xff1a; 1.标签 List item label&#xff08;标签&#xff09;: 标签是标识程序位置的记号。通常定义一个名称然后加上":"后缀。…...

Linux C 网络编程概述

网络编程 计算机网络概述分类网络体系结构通信协议通信流程网络通信帧格式以太网帧格式分析ARP 协议分析IP 数据报分析IP分类IP 分配子网掩码 TCP 段分析 TCP三次握手协议 ⭐TCP四次挥手协议 ⭐ TCP编程基于 TCP 客户端编程-步骤说明基于 TCP 服务器端编程-步骤说明基于 TCP 服…...

腾讯云标准型s5和s6有什么区别?CPU处理器有差异吗?

腾讯云服务器CVM标准型S5和S6有什么区别&#xff1f;都是标准型云服务器&#xff0c;标准型S5是次新一代云服务器规格&#xff0c;标准型S6是最新一代的云服务器&#xff0c;S6实例的CPU处理器主频性能要高于S5实例&#xff0c;同CPU内存配置下的标准型S6实例要比S5实例性能更好…...

WPF TextBox实现placeholder

WPF里TextBox没有placeholder&#xff0c;需要自己实现&#xff0c;本篇博客介绍WPF TextBox实现placeholder&#xff0c;效果如下&#xff1a; 实现技巧是在 TextBox 控件的 Style 中使用触发器&#xff08;Triggers&#xff09;来显示和隐藏placeholder文本。xmal代码如下&am…...

UiPath Studio 2023.10 Crack

UiPath Studio是一款功能强大且用户友好的集成开发环境 (IDE)&#xff0c;专为机器人流程自动化 (RPA) 设计。它由自动化技术领域的领先公司UiPath开发。 以下是 UiPath Studio 的一些主要功能和组件&#xff1a; 图形用户界面 (GUI)&#xff1a;UiPath Studio 具有直观且用户友…...

SpringBoot——入门及原理

SpringBoot用来简化Spring应用开发&#xff0c;约定大于配置&#xff0c;去繁从简&#xff0c;是由Pivotal团队提供的全新框架。其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置&#xff08;有特殊需求可以添加自己的配置覆盖默认配…...

js实现页面滚动时自动切换Sidebar标签,点击标签自动滚动页面

js实现页面滚动时自动切换Sidebar侧边导航标签&#xff0c;点击标签自动滚动页面 <van-sidebar class"sidebar" v-model"activeKey"><van-sidebar-item :title"i.title" click"onChange(i)" v-for"(i,k) in activeList&…...

Failed to load resource: net::ERR_UPLOAD_FILE_CHANGED 谷歌浏览器就会有这个问题 其他的浏览器没有

Failed to load resource: net::ERR_UPLOAD_FILE_CHANGED 10 10: Difficulties in file uploading through all browsers and applications...

微信小程序 prettier 格式化

一、安装prettier插件 二、打开设置 然后再打开setting.json 新增代码 {"editor.formatOnSave": true,"editor.defaultFormatter": "esbenp.prettier-vscode","prettier.documentSelectors": ["**/*.wxml", "**/*.wx…...

SystemVerilog学习 (10)——线程控制

一、概述 在实际硬件中,时序逻辑通过时钟沿来激活,组合逻辑的输出则随着输人的变化而变化。所有这些并发的活动在Verilog 的寄存器传输级上是通过initial和 always块语句、实例化和连续赋值语句来模拟的。为了模拟和检验这些语句块,测试平台使用许多并发执行的线程。在测试平台…...

【开题报告】基于SpringBoot的二手汽车交易平台的设计与实现

1.研究背景 随着社会经济的不断发展&#xff0c;二手汽车交易市场逐渐壮大&#xff0c;二手汽车交易平台作为一种重要的电子商务形式备受关注。本文基于Spring Boot框架&#xff0c;旨在设计与实现一个高效、安全、用户友好的二手汽车交易平台。本文将深入探讨二手汽车市场发展…...

Python 爬虫入门

文章目录 Python 爬虫入门requests 库beautifulsoup4库函数findall()&#xff0c;find()函数get() 爬虫实例 1&#xff1a;抓小说爬虫实例 2&#xff1a;抓豆瓣 top 250 的电影信息后记 Python 爬虫入门 Python 的爬虫功能使得程序员可以快速抓取并分析网页中的信息&#xff0…...

[ 加密 ] SHA256

SHA256 例程 一般文件的完整性要使用md5或者sha进行完整性校验&#xff0c;这里提供两个函数&#xff0c; intact_update_sha 是计算指定文件SHA值并保存到SHA文件 intact_check_sha 计算文件SHA值并和SHA文件进行对比 编译方法&#xff1a; gcc demo.c -lssl -lcrypto #…...

推荐一个windows上传linux服务器/linux服务器的docker镜像的工具,摆脱docker cp,以及解决常见问题。

Lrzsz&#xff0c;又称为lrz和lsz&#xff0c;是一个用于在Unix、Linux、macOS等操作系统上进行串行文件传输的工具。它支持基于X/Y/ZModem协议的文件传输&#xff0c;能够通过串口或者Telnet/SSH等网络连接进行文件传输。Lrzsz具有传输速度快、可靠性高、易于使用等特点&#…...

《QT从基础到进阶·三十五》QT插件实现侧边工具栏tabBar

tabBar是用QT插件实现的一个dll&#xff0c;对于插件的使用可以参考文章&#xff1a; 《QT从基础到进阶三十三》QT插件开发QtPlugin 源码放在文章末尾 该功能类似侧边工具栏&#xff0c;可以在该标签栏上添加自己开发的界面&#xff0c;实现代码如下&#xff1a; 1、所有功能…...

【人工智能】神经网络的优化器optimizer(二):Adagrad自适应学习率优化器

一.自适应梯度算法Adagrad概述 Adagrad&#xff08;Adaptive Gradient Algorithm&#xff09;是一种自适应学习率的优化算法&#xff0c;由Duchi等人在2011年提出。其核心思想是针对不同参数自动调整学习率&#xff0c;适合处理稀疏数据和不同参数梯度差异较大的场景。Adagrad通…...

在rocky linux 9.5上在线安装 docker

前面是指南&#xff0c;后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...

实现弹窗随键盘上移居中

实现弹窗随键盘上移的核心思路 在Android中&#xff0c;可以通过监听键盘的显示和隐藏事件&#xff0c;动态调整弹窗的位置。关键点在于获取键盘高度&#xff0c;并计算剩余屏幕空间以重新定位弹窗。 // 在Activity或Fragment中设置键盘监听 val rootView findViewById<V…...

Springboot社区养老保险系统小程序

一、前言 随着我国经济迅速发展&#xff0c;人们对手机的需求越来越大&#xff0c;各种手机软件也都在被广泛应用&#xff0c;但是对于手机进行数据信息管理&#xff0c;对于手机的各种软件也是备受用户的喜爱&#xff0c;社区养老保险系统小程序被用户普遍使用&#xff0c;为方…...

基于SpringBoot在线拍卖系统的设计和实现

摘 要 随着社会的发展&#xff0c;社会的各行各业都在利用信息化时代的优势。计算机的优势和普及使得各种信息系统的开发成为必需。 在线拍卖系统&#xff0c;主要的模块包括管理员&#xff1b;首页、个人中心、用户管理、商品类型管理、拍卖商品管理、历史竞拍管理、竞拍订单…...

C++实现分布式网络通信框架RPC(2)——rpc发布端

有了上篇文章的项目的基本知识的了解&#xff0c;现在我们就开始构建项目。 目录 一、构建工程目录 二、本地服务发布成RPC服务 2.1理解RPC发布 2.2实现 三、Mprpc框架的基础类设计 3.1框架的初始化类 MprpcApplication 代码实现 3.2读取配置文件类 MprpcConfig 代码实现…...

DiscuzX3.5发帖json api

参考文章&#xff1a;PHP实现独立Discuz站外发帖(直连操作数据库)_discuz 发帖api-CSDN博客 简单改造了一下&#xff0c;适配我自己的需求 有一个站点存在多个采集站&#xff0c;我想通过主站拿标题&#xff0c;采集站拿内容 使用到的sql如下 CREATE TABLE pre_forum_post_…...

若依登录用户名和密码加密

/*** 获取公钥&#xff1a;前端用来密码加密* return*/GetMapping("/getPublicKey")public RSAUtil.RSAKeyPair getPublicKey() {return RSAUtil.rsaKeyPair();}新建RSAUti.Java package com.ruoyi.common.utils;import org.apache.commons.codec.binary.Base64; im…...

goreplay

1.github地址 https://github.com/buger/goreplay 2.简单介绍 GoReplay 是一个开源的网络监控工具&#xff0c;可以记录用户的实时流量并将其用于镜像、负载测试、监控和详细分析。 3.出现背景 随着应用程序的增长&#xff0c;测试它所需的工作量也会呈指数级增长。GoRepl…...

Springboot 高校报修与互助平台小程序

一、前言 随着我国经济迅速发展&#xff0c;人们对手机的需求越来越大&#xff0c;各种手机软件也都在被广泛应用&#xff0c;但是对于手机进行数据信息管理&#xff0c;对于手机的各种软件也是备受用户的喜爱&#xff0c;高校报修与互助平台小程序被用户普遍使用&#xff0c;为…...