详细介绍 Oracle中的Materialized Views(物化视图/快照)

news2025/1/21 3:18:17

A materialized view (snapshot) is a table segment whose contents are periodically refereshed based on query (against a local or remote table)(针对的本地或者远程表)

The simplest way to achieve replication of data between sites for against remote tables:

materiralized views

 

Basic Syntax

create materialized view

-- Normal
CREATE MATERIALIZED VIEW view-name
BUILD [IMMEDIATE | DEFERRED]
REFRESH [FAST | COMPLETE | FORCE ]
ON [COMMIT | DEMAND ]
[[ENABLE | DISABLE] QUERY REWRITE]
AS
SELECT ...;

-- Pre-Built
CREATE MATERIALIZED VIEW view-name
ON PREBUILT TABLE
REFRESH [FAST | COMPLETE | FORCE ]
ON [COMMIT | DEMAND ]
[[ENABLE | DISABLE] QUERY REWRITE]
AS
SELECT ...;

The build clause options are shown below :

  • IMMEDIATE:  mv is populated immediately.
  • DEFFERED: mv is populated on the first requested refresh.

The following refresh type are avaliable:

  1. FAST : mv logs are not present for source tables in
  2. COMPLETE
  3. FORCE

A fresh can be triggered :

  • ON COMMIT: data change in one of the dependent tables be committed
  • ON DEMAND: manual request or a schedule task

The QUERY REWRITE clause tells the optimizer if the materialized view should be consider for query rewrite operations. 

The ON PREBUILT TABLE clause tells the database to use an existing table segment, which must have the same name as the materialized view and support the same column structure as the query.

Check Privileges

[oracle@oracle-db-19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 27 15:18:35 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show user;
USER is "SYS"
SQL> 
SQL> ALTER SESSION SET CONTAINER=PDB1;

Session altered.

SQL> grant create materialized view to scott;

Grant succeeded.

SQL> grant create database link to scott;

Grant succeeded.

SQL> 

SQL> conn scott/tiger@PDB1
Connected.
SQL> show con_name;

CON_NAME
------------------------------
PDB1
SQL> set pagesize 200
SQL> set linesize 200
SQL> 
SQL> select * from session_privs;

PRIVILEGE
----------------------------------------
CREATE SESSION
UNLIMITED TABLESPACE
CREATE TABLE
CREATE CLUSTER
CREATE SEQUENCE
CREATE DATABASE LINK
CREATE PROCEDURE
CREATE TRIGGER
CREATE MATERIALIZED VIEW
CREATE TYPE
CREATE OPERATOR
CREATE INDEXTYPE
SET CONTAINER

13 rows selected.

SQL> 

Create DBLINK

SQL> show user
USER is "SYS"
SQL> 
SQL> grant CREATE PUBLIC DATABASE LINK,DROP PUBLIC DATABASE LINK to scott;

Grant succeeded.

SQL> column owner for a40
SQL> column object_name for a40
SQL> select owner,object_name from dba_objects where object_type='DATABASE LINK';

OWNER                                    OBJECT_NAME
---------------------------------------- ----------------------------------------
SYS                                      SYS_HUB

SQL> COLUMN owner FORMAT A30
SQL> COLUMN db_link FORMAT A30
SQL> COLUMN username FORMAT A30
SQL> COLUMN host FORMAT A30
SQL> select owner,db_link,username,host from dba_db_links order by owner,db_link;

OWNER                          DB_LINK                        USERNAME                       HOST
------------------------------ ------------------------------ ------------------------------ ------------------------------
SYS                            SYS_HUB                                                       SEEDDATA

SQL> select owner,object_name from dba_objects where object_type='DATABASE LINK';

OWNER                          OBJECT_NAME
------------------------------ ----------------------------------------
SYS                            SYS_HUB

SQL> 
SQL> show user;
USER is "SCOTT"
SQL> 
SQL> create public database link LINK_ORCLPDB1
  2  connect to SCOTT identified by "TIGER"
  3  using
  4  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ORCLPDB1)))';

Database link created.

SQL> 



SQL> show user
USER is "SYS"
SQL> select owner,object_name from dba_objects where object_type='DATABASE LINK';

OWNER                          OBJECT_NAME
------------------------------ ----------------------------------------
SYS                            SYS_HUB
PUBLIC                         LINK_ORCLPDB1

SQL> 

SQL> show user
USER is "SCOTT"
SQL> 
SQL> select * from SCOTT.emp@LINK_ORCLPDB1;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.

SQL> 

Create Materialized View

SQL> show user;
USER is "SCOTT"
SQL> 
SQL> CREATE MATERIALIZED VIEW emp_mv
  2  BUILD IMMEDIATE
  3  REFRESH FORCE
  4  ON DEMAND
  5  AS
  6  SELECT * FROM emp@link_orclpdb1;

Materialized view created.

SQL> 

Remember to gather stats after building the materialized view.

SQL> BEGIN
  2    DBMS_STATS.gather_table_stats(
  3      ownname => 'SCOTT',
  4      tabname => 'EMP_MV');
  5  END;
  6  /

PL/SQL procedure successfully completed.

SQL> 

Create Materialized View Logs

Since a complete refresh involves truncating the materialized view segment and re-populating it using the related query, it can be quite time consuming and involve a considerable amount of network traffic when performed against a remote table. To reduce the replication costs, materialized view logs can be created to capture all changes to the base table since the last refresh. This information allows a fast refresh, which only needs to apply the changes rather than a complete refresh of the materialized view.

To take advantage of the of the fast refresh, connect to the master instance and create the materialized view log.

Code:

CREATE MATERIALIZED VIEW LOG ON SCOTT.EMP
TABLESPACE users
WITH PRIMARY KEY
INCLUDING NEW VALUES;

 Options:

[oracle@MaxwellDBA ~]$ sqlplus SCOTT/TIGER@ORCLPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 27 16:14:53 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Fri Nov 18 2022 19:37:15 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

scott@orclpdb1:orclcdb> show user
USER is "SCOTT"
scott@orclpdb1:orclcdb> CREATE MATERIALIZED VIEW LOG ON SCOTT.EMP
  2  TABLESPACE users
WITH PRIMARY KEY
  4  INCLUDING NEW VALUES;

Materialized view log created.

scott@orclpdb1:orclcdb> 

Refresh Materialized Views

If a materialized view is configured to refresh on commit, you should never need to manually refresh it, unless a rebuild is necessary. Remember, refreshing on commit is a very intensive operation for volatile base tables. It makes sense to use fast refreshes where possible.

For on demand refreshes, you can choose to manually refresh the materialized view or refresh it as part of a refresh group.

The following code creates a refresh group defined to refresh every minute and assigns a materialized view to it.

Code :

BEGIN
   DBMS_REFRESH.make(
     name                 => 'SCOTT.MINUTE_REFRESH',
     list                 => '',
     next_date            => SYSDATE,
     interval             => '/*1:Mins*/ SYSDATE + 1/(60*24)',
     implicit_destroy     => FALSE,
     lax                  => FALSE,
     job                  => 0,
     rollback_seg         => NULL,
     push_deferred_rpc    => TRUE,
     refresh_after_errors => TRUE,
     purge_option         => NULL,
     parallelism          => NULL,
     heap_size            => NULL);
END;
/

BEGIN
   DBMS_REFRESH.add(
     name => 'SCOTT.MINUTE_REFRESH',
     list => 'SCOTT.EMP_MV',
     lax  => TRUE);
END;
/

Options:

[oracle@oracle-db-19c ~]$ sqlplus scott/tiger@PDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 27 16:56:15 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Sun Nov 27 2022 16:50:40 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> 
SQL> BEGIN
  2     DBMS_REFRESH.make(
  3       name                 => 'SCOTT.MINUTE_REFRESH',
  4       list                 => '',
  5       next_date            => SYSDATE,
  6       interval             => '/*1:Mins*/ SYSDATE + 1/(60*24)',
  7       implicit_destroy     => FALSE,
  8       lax                  => FALSE,
  9       job                  => 0,
 10       rollback_seg         => NULL,
 11       push_deferred_rpc    => TRUE,
 12       refresh_after_errors => TRUE,
 13       purge_option         => NULL,
 14       parallelism          => NULL,
 15       heap_size            => NULL);
 16  END;
 17  /

PL/SQL procedure successfully completed.

SQL> BEGIN
  2     DBMS_REFRESH.add(
  3       name => 'SCOTT.MINUTE_REFRESH',
  4       list => 'SCOTT.EMP_MV',
  5       lax  => TRUE);
  6  END;
  7  /

PL/SQL procedure successfully completed.

SQL> 

Information about refresh groups and the materialize views in a refresh group can be queried from the DBA_RGROUP and DBA_RCHILD views respectively.

SQL> column owner for a20
SQL> column name for a20
SQL> column ROLLBACK_SEG for a20
SQL> column JOB_NAME for a20
SQL> select * from dba_rgroup;

  REFGROUP OWNER                NAME                 I P R ROLLBACK_SEG                JOB PURGE_OPTION PARALLELISM  HEAP_SIZE JOB_NAME
---------- -------------------- -------------------- - - - -------------------- ---------- ------------ ----------- ---------- --------------------
         5 SCOTT                MINUTE_REFRESH       N Y Y                               0                                     MV_RF$J_0_S_130

SQL> desc dba_rchild;
 Name                                                                                                              Null?    Type
 ----------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------
 REFGROUP                                                                                                                   NUMBER
 OWNER                                                                                                             NOT NULL VARCHAR2(128)
 NAME                                                                                                              NOT NULL VARCHAR2(128)
 TYPE#                                                                                                                      VARCHAR2(128)

SQL> column owner for a20
SQL> column name for a20
SQL> column REFGROUP for a20
SQL> column TYPE for a20
SQL> select * from dba_rchild;

  REFGROUP OWNER                NAME                 TYPE#
---------- -------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------
########## SCOTT                EMP_MV               SNAPSHOT

SQL> column REFGROUP default
SQL> select * from dba_rchild;

  REFGROUP OWNER                NAME                 TYPE#
---------- -------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------
         5 SCOTT                EMP_MV               SNAPSHOT

SQL> 

befor 1 minutes & after 1 minutes;

SQL> select * from emp_mv;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.

SQL> select * from emp_mv;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        400                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1200        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81        850        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2575                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81        850       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2450                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2050                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       2600                    20
      7839 KING       PRESIDENT            17-NOV-81       4600                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1100          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87        700                    20
      7900 JAMES      CLERK           7698 03-DEC-81        550                    30
      7902 FORD       ANALYST         7566 03-DEC-81       2600                    20
      7934 MILLER     CLERK           7782 23-JAN-82        900                    10

14 rows selected.

SQL> 
SQL> 

A materialized view can be manually refreshed using the DBMS_MVIEW package.

Code:

EXEC DBMS_MVIEW.refresh('EMP_MV');

Options:

SQL> select * from emp_mv;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30

14 rows selected.

SQL>
SQL> EXEC DBMS_MVIEW.refresh('EMP_MV');

PL/SQL procedure successfully completed.

SQL> select * from emp_mv;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7782 CLARK      MANAGER         7839 09-JUN-81       2350                    10
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1500        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1150        500         30
      7788 SCOTT      ANALYST         7566 19-APR-87       2900                    20
      7876 ADAMS      CLERK           7788 23-MAY-87       1000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1200                    10
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1150       1400         30
      7902 FORD       ANALYST         7566 03-DEC-81       2900                    20
      7839 KING       PRESIDENT            17-NOV-81       4900                    10
      7369 SMITH      CLERK           7902 17-DEC-80        700                    20
      7566 JONES      MANAGER         7839 02-APR-81       2875                    20
      7844 TURNER     SALESMAN        7698 08-SEP-81       1400          0         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2750                    30
      7900 JAMES      CLERK           7698 03-DEC-81        850                    30

14 rows selected.

SQL> show user;
USER is "SCOTT"
SQL> 

Cleaning Up

code:

sqlplus scott/tiger@PDB1
DROP MATERIALIZED VIEW emp_mv;
DROP PUBLIC DATABASE LINK LINK_ORCLPDB1;

BEGIN
 DBMS_REFRESH.destroy(name=>'SCOTT.MINUTE_REFRESH'); 
END;
/

sqlplus SCOTT/TIGER@ORCLPDB1

DROP MATERIALIZED VIEW LOG ON SCOTT.EMP;

options:

[oracle@oracle-db-19c ~]$ sqlplus scott/tiger@PDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 27 17:27:17 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Sun Nov 27 2022 17:07:11 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> DROP MATERIALIZED VIEW emp_mv;

Materialized view dropped.

SQL> 

SQL> DROP PUBLIC DATABASE LINK LINK_ORCLPDB1;

Database link dropped.

SQL> BEGIN
  2   DBMS_REFRESH.destroy(name=>'SCOTT.MINUTE_REFRESH'); 
  3  END;
  4  /

PL/SQL procedure successfully completed.

SQL> 


[oracle@MaxwellDBA ~]$ 
[oracle@MaxwellDBA ~]$ sqlplus SCOTT/TIGER@ORCLPDB1;

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 27 17:30:30 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Sun Nov 27 2022 17:27:27 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

scott@orclpdb1:orclcdb> 
scott@orclpdb1:orclcdb> DROP MATERIALIZED VIEW LOG ON SCOTT.EMP;

Materialized view log dropped.

scott@orclpdb1:orclcdb> 

Aggregations and Transformations

Materialized views can be used to improve the performance of a variety of queries, including those performing aggregations and transformations of the data. This allows the work to be done once and used repeatedly by multiple sessions, reducing the total load on the server.

The following query does an aggregation of the data in the EMP table.

Code:

show user;
set autotrace trace explain

select deptno,sum(sal)
from emp
group by deptno;

Options:

SQL> show user;
USER is "SCOTT"
SQL> 
SQL> set autotrace trace explain
SQL> 
SQL> select deptno,sum(sal)
  2  from emp
  3  group by deptno;

Execution Plan
----------------------------------------------------------
Plan hash value: 4067220884

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     3 |    21 |     4  (25)| 00:00:01 |
|   1 |  HASH GROUP BY     |      |     3 |    21 |     4  (25)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| EMP  |    14 |    98 |     3   (0)| 00:00:01 |
---------------------------------------------------------------------------

SQL> 

Create a materialized view to perform the aggregation in advance, making sure you specify the ENABLE QUERY REWRITE clause.



SQL> show user;
USER is "SCOTT"
SQL> CREATE MATERIALIZED VIEW emp_aggr_mv
  2  BUILD IMMEDIATE 
  3  REFRESH FORCE
  4  ON DEMAND
  5  ENABLE QUERY REWRITE 
  6  AS
  7  SELECT deptno, SUM(sal) AS sal_by_dept
  8  FROM   emp
  9  GROUP BY deptno;

Materialized view created.

SQL> EXEC DBMS_STATS.gather_table_stats(USER, 'EMP_AGGR_MV');

PL/SQL procedure successfully completed.

SQL>

The same query is now rewritten to take advantage of the pre-aggregated data in the materialized view, instead of the session doing the work for itself.


Code:

--ALTER SESSION SET QUERY_REWRITE_INTEGRITY = TRUSTED; 
--ALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE;
SET AUTOTRACE TRACE EXPLAIN

SELECT deptno, SUM(sal)
FROM   emp
GROUP BY deptno;

Options:

SQL> set pagesize 500
SQL> set linesize 500
SQL> SET AUTOTRACE TRACE EXPLAIN
SQL> SELECT deptno, SUM(sal)
  2  FROM   emp
  3  GROUP BY deptno;

Execution Plan
----------------------------------------------------------
Plan hash value: 2456459487

--------------------------------------------------------------------------------------------
| Id  | Operation                    | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT             |             |     3 |    21 |     3   (0)| 00:00:01 |
|   1 |  MAT_VIEW REWRITE ACCESS FULL| EMP_AGGR_MV |     3 |    21 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------------------------

SQL> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/40605.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

中断上下文和进程上下文

中断上下文 参考博客:(https://blog.csdn.net/AndroidBBC/article/details/81911065) 中断上半部分,中断触发;中断下半部分,中断执行。 中断执行一般有tasklet、工作队列实现 工作队列机制 工作队列所执行的中断代码会表现出进…

Linux | 第一篇——常见指令汇总【超全、超详细讲解】

Linux之常见指令🌳前言💻操作系统的概念💻Linux的使用环境介绍🌳基本指令汇总一、【whoami】指令二、【pwd】指令三、【mkdir】指令四、【touch】指令五、【ls】指令1、拓展:文件的概念2、命令 - 命令选项六、【cd】指…

AtCoder Beginner Contest 260 G.Scalene Triangle Area(花式二维差分/二维线段树)

题目 n*n的网格(n<2e3)&#xff0c; 每个网格内的字符是O或者X&#xff0c;其中O表示(i,j)上有一个棋子&#xff0c;X表示没有 位于(s,t)棋子覆盖住了方格(u,v)&#xff0c;当且仅当&#xff1a; 1. 2. 3. q(q<2e5)次询问&#xff0c;第i次给出一个方格位置(xi…

如何给在 SAP Business Application Studio 里开发的 OData 服务准备测试数据试读版

在开始本步骤的学习之前&#xff0c;请大家务必完成前一步骤1. SAP Business Application Studio 里创建一个基于 CAP 模型的最简单的 OData 服务的学习。换言之&#xff0c;大家已经在 SAP Business Technology Platform 上的 Business Application Studio 里&#xff0c;创建…

Python实现基于Optuna超参数自动优化的xgboost回归模型(XGBRegressor算法)项目实战

说明&#xff1a;这是一个机器学习实战项目&#xff08;附带数据代码文档视频讲解&#xff09;&#xff0c;如需数据代码文档视频讲解可以直接到文章最后获取。 1.项目背景 Optuna是一个开源的超参数优化(HPO)框架&#xff0c;用于自动执行超参数的搜索空间。 为了找到最佳的超…

docker 部署多个前端vue项目

文章目录一、docker 部署前端项目方案1. 方案12. 方案2二、Nginx配置运行2.1. 拉取nginx镜像2.2. 创建配置目录2.3. 创建Nginx容器三、部署前端项目3.1. 压缩3.2. 上传3.3. 验证附录index.html50x.htmlnginx.conf一、docker 部署前端项目方案 1. 方案1 一个docker容器对应一个…

java中“冷门”工具类的总结

文章目录前言一些不常用的工具类不可变集合多值MapTable表Lists、Maps、Sets字符串操作BagLazyList双向Map并发集合小总结CopyOnWriteArrayListConcurrentHashMap前言 最近挖掘了一些在项目中不常用的工具类&#xff0c;有些实用性还是很高的&#xff0c;特此总结一下。 另外又…

mysql中的这些日志,你都知道吗 2?

上一篇文章&#xff0c;我们介绍了binlog和redo log这两种日志&#xff0c;对这两种日志不熟悉的老铁可以看下"mysql中的这些日志&#xff0c;你都知道吗",在上篇文章的末尾&#xff0c;作者还留了一个问题&#xff1a;binlog 和 redo log两个相互独立的日志模块&…

kube-ovn安装与卸载

1.环境准备 Kube-OVN 是一个符合 CNI 规范的网络组件&#xff0c;其运行需要依赖 Kubernetes 环境及对应的内核网络模块。 以下是通过测试的操作系统和软件版本&#xff0c;环境配置和所需要开放的端口信息。1.1 软件版本 Kubernetes > 1.16 且 < 1.24&#xff0c;推荐…

RK3568平台开发系列讲解(音频篇)Android AudioRecord 采集音频

🚀返回专栏总目录 文章目录 一、Android 平台的音频采集技术选型1.1、SDK 层提供的采集方法1.2、NDK 层提供的采集方法二、AudioRecord 采集音频沉淀、分享、成长,让自己和他人都能有所收获!😄 📢 Android 平台音频采集的技术选型,在 SDK 层和 NDK 层各有两套音频采集…

【MySQL】MySQL参数调优与实战详解(调优篇)(实战篇)(MySQL专栏启动)

&#x1f4eb;作者简介&#xff1a;小明java问道之路&#xff0c;专注于研究 Java/ Liunx内核/ C及汇编/计算机底层原理/源码&#xff0c;就职于大型金融公司后端高级工程师&#xff0c;擅长交易领域的高安全/可用/并发/性能的架构设计与演进、系统优化与稳定性建设。 &#x1…

dataloader重构与keras入门体验

原创文章第117篇&#xff0c;专注“个人成长与财富自由、世界运作的逻辑&#xff0c; AI量化投资”。 北京疫情昨天突破4000&#xff0c;社会面800。看来三天的预期过于乐观了&#xff0c;不知道如何发展。如同资本市场的短期走势&#xff0c;没有人可以预测。但往前看三年&am…

Python性能优化

正文 python为什么性能差&#xff1a; 当我们提到一门编程语言的效率时&#xff1a;通常有两层意思&#xff0c;第一是开发效率&#xff0c;这是对程序员而言&#xff0c;完成编码所需要的时间&#xff1b;另一个是运行效率&#xff0c;这是对计算机而言&#xff0c;完成计算任…

Elasticsearch 8.X DSL 如何优化更有助于提升检索性能?

1、企业级实战 DSL&#xff08;数据已经脱敏&#xff09; 2、大家可以看一下&#xff0c;能发现哪些问题&#xff1f; 根据我的实战和咨询经验&#xff0c;我发现如下几个问题。当然&#xff0c;这是在和球友交流确认问题之后总结出来的。2.1 问题1&#xff1a;bool 组合嵌套过…

动态加载布局的技巧

文章目录动态加载布局的技巧使用限定符使用最小宽度限定符动态加载布局的技巧 使用限定符 在平板上面大多数时候采用的双页的模式,程序会在左侧列表上显示一个包含子项列表,右侧的面版会显示详细的内容的因为平板具有足够大的屏幕.完全能够显示两页的内容.但是在手机上手机只能…

事业编招聘:雄安新区公开选聘专业骨干人才

河北雄安新区公开选聘专业骨干人才公告 根据河北雄安新区建设发展工作需要&#xff0c;决定面向全国机关、企事业单位选聘部分专业骨干人才&#xff0c;现将有关事项公告如下&#xff1a; 一、选聘计划 共选聘20名专业骨干人才。 二、选聘范围 全国机关和企事业单位工作人员。…

Java包装类

为什么有包装类&#xff1f; 在Java中&#xff0c;基本数据类型不是继承自Object&#xff0c;为了在泛型中可以支持基本数据类型&#xff0c;Java给每个基本数据类型都对应了一个包装类。【基本数据类型不符合面向对象思想&#xff0c;基本类型不是对象&#xff0c;从而基本数据…

机器学习中的数学原理——梯度下降法(最速下降法)

好久没更新了&#xff0c;确实是有点懒了&#xff0c;主要是这两天返乡在隔离&#xff08;借口&#xff09;。这个专栏主要是用来分享一下我在机器学习中的学习笔记及一些感悟&#xff0c;也希望对你的学习有帮助哦&#xff01;感兴趣的小伙伴欢迎私信或者评论区留言&#xff0…

开放一批PCB资源(二)

这些板卡&#xff0c;都已经停产&#xff0c;现其PCB和原理图对外开放&#xff0c;都是cadence格式。 有需要的加我微信联系。&#xff08;微信&#xff1a;18633364981&#xff09; 这是开放的第二批&#xff0c;后续还有。这一批的价格象征性的收费每个 2000元。 这些板卡…

【操作系统基础】系统接口与系统调用

本文参考MOOC哈工大操作系统课程与课件 主要基于Linux 0.11系统展开 ”Author&#xff1a;Mayiming“ 文章目录一、操作系统接口1. 什么是操作系统接口&#xff1f;2. 操作系统接口体现在哪&#xff1f;3. 命令行是怎么执行代码的&#xff1f;4. 图形界面是怎么执行代码的&…