postgresql执行计划解读案例

news2024/10/18 12:37:20

简介

SQL优化中读懂执行计划尤其重要,以下举例说明在执行计划中常见的参数其所代表的含义。

创建测试数据
-- 创建测试表
drop table if exists customers ;
drop table if exists orders ;
drop table if exists order_items ;
drop table if exists products ;
CREATE TABLE customers (
    customer_id SERIAL PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    registration_date DATE NOT NULL
);
CREATE TABLE orders (
    order_id SERIAL PRIMARY KEY,
    customer_id INT REFERENCES customers(customer_id),
    order_date DATE NOT NULL,
    total_amount NUMERIC(10, 2) NOT NULL
);
CREATE TABLE order_items (
    order_item_id SERIAL PRIMARY KEY,
    order_id INT REFERENCES orders(order_id),
    product_name VARCHAR(100) NOT NULL,
    quantity INT NOT NULL,
    price_per_item NUMERIC(10, 2) NOT NULL
);
CREATE TABLE products (
    product_id SERIAL PRIMARY KEY,
    product_name VARCHAR(100) NOT NULL,
    product_category VARCHAR(100) NOT NULL,
    price NUMERIC(10, 2) NOT NULL
);


 -- 插入数据
INSERT INTO customers (name, registration_date)
VALUES 
('Alice', '2022-01-10'),
('Bob', '2022-01-15'),
('Charlie', '2022-01-20');
INSERT INTO products (product_name, product_category, price)
VALUES 
('Laptop', 'Electronics', 1200.00),
('Headphones', 'Electronics', 150.00),
('Coffee Maker', 'Home Appliances', 80.00);
INSERT INTO orders (customer_id, order_date, total_amount)
VALUES 
(1, '2022-01-12', 1350.00),
(2, '2022-01-16', 80.00),
(3, '2022-01-21', 1200.00);

INSERT INTO order_items (order_id, product_name, quantity, price_per_item)
VALUES 
(1, 'Laptop', 1, 1200.00),
(1, 'Headphones', 1, 150.00),
(2, 'Coffee Maker', 1, 80.00),
(3, 'Laptop', 1, 1200.00);


创建测试SQL
SELECT
    c.customer_id,
    c.name AS customer_name,
    EXTRACT(YEAR FROM o.order_date) AS order_year,
    COUNT(o.order_id) AS total_orders,
    SUM(o.total_amount) AS total_spent,
    COUNT(oi.order_item_id) AS total_order_items
FROM
    customers c
JOIN
    orders o ON c.customer_id = o.customer_id
JOIN
    order_items oi ON o.order_id = oi.order_id
GROUP BY
    c.customer_id, c.name, EXTRACT(YEAR FROM o.order_date)
HAVING
    SUM(o.total_amount) > 500
ORDER BY
    total_spent DESC;

可选参数
explain (ANALYZE,BUFFERS,COSTS,FORMAT,GENERIC_PLAN,SETTINGS,SUMMARY,TIMING,VERBOSE,WAL)

ANALYZE:

执行查询并返回实际执行时间和行数统计信息。通过 ANALYZE 参数,您可以得到实际执行的时间、读取的行数以及执行的次数。

BUFFERS:

显示每一步骤的缓冲区(Buffer)访问情况,包括共享缓冲区、临时缓冲区的读取与写入。这能帮助您分析查询是否大量访问磁盘或者是否存在频繁的内存缓冲区使用。

COSTS :

显示估计的执行成本,包括启动成本(执行查询前的初始成本)和总成本。默认情况下,EXPLAIN 会显示成本,使用 COSTS 参数可以控制是否显示这些成本。

FORMAT :

可以指定输出的格式,常用的格式有 JSON TEXT XML YAML 。这对于自动化系统解析查询计划非常有用。

GENERIC_PLAN:

示 EXPLAIN 使用的通用查询计划,而不是为特定参数生成的计划。对于预处理语句或准备好的查询,使用此选项可以查看 PostgreSQL 生成的通用计划。

SETTINGS:

显示在执行查询时使用的设置(如 work_mem、max_parallel_workers_per_gather 等)。这有助于了解查询执行时使用了哪些配置参数。

SUMMARY:

显示执行计划的总结信息,包括计划时间、执行时间、缓冲区统计等。默认情况下,SUMMARY 会显示。

TIMING:

显示每个执行步骤的时间,默认是启用的。禁用后可以减少执行计划输出的细节,这在某些场景下有助于简化分析。

VERBOSE:

显示更多详细信息,包括表名、索引名和每个扫描步骤涉及的列名。适合进行详细调试。

WAL:

显示查询生成了多少 WAL(预写日志)活动。这对于调试写操作尤其有用,可以分析查询对 WAL 的影响。

列举示例
 postgres=# explain (ANALYZE)
postgres-# SELECT
postgres-#     c.customer_id,
postgres-#     c.name AS customer_name,
postgres-#     EXTRACT(YEAR FROM o.order_date) AS order_year,
postgres-#     COUNT(o.order_id) AS total_orders,
postgres-#     SUM(o.total_amount) AS total_spent,
postgres-#     COUNT(oi.order_item_id) AS total_order_items
postgres-# FROM
postgres-#     customers c
postgres-# JOIN
postgres-#     orders o ON c.customer_id = o.customer_id
postgres-# JOIN
postgres-#     order_items oi ON o.order_id = oi.order_id
postgres-# GROUP BY
postgres-#     c.customer_id, c.name, EXTRACT(YEAR FROM o.order_date)
postgres-# HAVING
postgres-#     SUM(o.total_amount) > 500
postgres-# ORDER BY
postgres-#     total_spent DESC;
                                                             QUERY PLAN                                                              
-------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=86.40..86.64 rows=97 width=302) (actual time=0.055..0.057 rows=2 loops=1)
   Sort Key: (sum(o.total_amount)) DESC
   Sort Method: quicksort  Memory: 25kB
   ->  HashAggregate  (cost=78.61..83.20 rows=97 width=302) (actual time=0.046..0.049 rows=2 loops=1)
         Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
         Filter: (sum(o.total_amount) > '500'::numeric)
         Batches: 1  Memory Usage: 37kB
         Rows Removed by Filter: 1
         ->  Hash Join  (cost=59.83..74.98 rows=290 width=278) (actual time=0.034..0.038 rows=4 loops=1)
               Hash Cond: (o.customer_id = c.customer_id)
               ->  Hash Join  (cost=42.62..56.29 rows=290 width=32) (actual time=0.014..0.016 rows=4 loops=1)
                     Hash Cond: (oi.order_id = o.order_id)
                     ->  Seq Scan on order_items oi  (cost=0.00..12.90 rows=290 width=8) (actual time=0.003..0.004 rows=4 loops=1)
                     ->  Hash  (cost=24.50..24.50 rows=1450 width=28) (actual time=0.004..0.005 rows=3 loops=1)
                           Buckets: 2048  Batches: 1  Memory Usage: 17kB
                           ->  Seq Scan on orders o  (cost=0.00..24.50 rows=1450 width=28) (actual time=0.003..0.003 rows=3 loops=1)
               ->  Hash  (cost=13.20..13.20 rows=320 width=222) (actual time=0.015..0.015 rows=3 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 9kB
                     ->  Seq Scan on customers c  (cost=0.00..13.20 rows=320 width=222) (actual time=0.007..0.008 rows=3 loops=1)
 Planning Time: 0.301 ms
 Execution Time: 0.097 ms
(21 rows)

以上案例为例,PG执行计划遵循从下到上,从里到外的规则。

  ->  Hash  (cost=24.50..24.50 rows=1450 width=28) (actual time=0.004..0.005 rows=3 loops=1)
                           Buckets: 2048  Batches: 1  Memory Usage: 17kB
                           ->  Seq Scan on orders o  (cost=0.00..24.50 rows=1450 width=28) (actual time=0.003..0.003 rows=3 loops=1)

Seq Scan on orders 对表orders顺序扫描,
(cost=0.00…24.50 rows=1450 width=28) 预估耗费成本,rows=1450预估扫描行1450 width=28预估扫描每行的宽度(以字节为单位),即每行大约占用 28字节。
(actual time=0.003…0.003 rows=3 loops=1) 实际消费成本,0.003…0.003: 0.003排序开始时间,0.003排序结束时间

对orders表扫描结束之后,会对其进行构建hash,常被用关联、嵌套等情况。
(cost=24.50…24.50 rows=1450 width=28) (actual time=0.004…0.005 rows=3 loops=1) 这两段解释同上相同
Buckets: 2048 Batches: 1 Memory Usage: 17kB
Buckets: 2048 表示哈希表中有 2048 个桶,每个桶用于存储散列结果相同的行。这是哈希表的一部分设计,用于分配空间。
Batches: 1 表示只需一批数据处理,因为表的大小足够小,整个哈希表可以存储在内存中。如果数据量非常大,PostgreSQL 可能会将哈希表分成多个批次处理,以防止内存不足。
Memory Usage: 17kB 是哈希表在内存中的大小,显示这次哈希操作所消耗的内存为 17KB。

  ->  Hash  (cost=13.20..13.20 rows=320 width=222) (actual time=0.015..0.015 rows=3 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 9kB
                     ->  Seq Scan on customers c  (cost=0.00..13.20 rows=320 width=222) (actual time=0.007..0.008 rows=3 loops=1)

Seq Scan on customers c 对customers 表进行顺序扫描, (cost=0.00…13.20 rows=320 width=222)
cost=0.00…13.20 扫描耗费的成本
rows=320 这是估计需要排序的行数
width=222:这是估算每行的宽度(以字节为单位),即每行大约占用 222字节。
actual time=0.007…0.008 为实际耗时,0.007毫秒是排序开始的时间,0.008毫秒是排序结束的时间。
rows=3 表示查询实际排序的行数是 2 行。
loops=1 表示实际执行了一次

 Sort  (cost=86.40..86.64 rows=97 width=302) (actual time=0.055..0.057 rows=2 loops=1)
   Sort Key: (sum(o.total_amount)) DESC
   Sort Method: quicksort  Memory: 25kB
   ->  HashAggregate  (cost=78.61..83.20 rows=97 width=302) (actual time=0.046..0.049 rows=2 loops=1)
         Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
         Filter: (sum(o.total_amount) > '500'::numeric)
         Batches: 1  Memory Usage: 37kB
         Rows Removed by Filter: 1

HashAggregate (cost=78.61…83.20 rows=97 width=302) (actual time=0.046…0.049 rows=2 loops=1)
表示进行聚合操作所需要的耗费。
Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
Group Key 表示使用的分组键
Filter: (sum(o.total_amount) > ‘500’::numeric) 表示用的过滤条件
Batches: 1 Memory Usage: 37kB 表示哈希聚合操作占用了 37kB 内存
Rows Removed by Filter: 1 被过滤掉的数据行数

此执行计划可以看出其预估行rows 和实际的rows 有较大的出入。实际上统计信息不是最新信息的问题导致,重新对其analyze单独执行重新收集一下统计信息就可以。
当执行vacuum full之后(也会自动进行analyze)


postgres=# explain (ANALYZE)
postgres-# SELECT
postgres-#     c.customer_id,
postgres-#     c.name AS customer_name,
postgres-#     EXTRACT(YEAR FROM o.order_date) AS order_year,
postgres-#     COUNT(o.order_id) AS total_orders,
postgres-#     SUM(o.total_amount) AS total_spent,
postgres-#     COUNT(oi.order_item_id) AS total_order_items
postgres-# FROM
postgres-#     customers c
postgres-# JOIN
postgres-#     orders o ON c.customer_id = o.customer_id
postgres-# JOIN
postgres-#     order_items oi ON o.order_id = oi.order_id
postgres-# GROUP BY
postgres-#     c.customer_id, c.name, EXTRACT(YEAR FROM o.order_date)
postgres-# HAVING
postgres-#     SUM(o.total_amount) > 500
postgres-# ORDER BY
postgres-#     total_spent DESC;
                                                           QUERY PLAN                                                            
---------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=3.35..3.36 rows=1 width=302) (actual time=0.063..0.065 rows=2 loops=1)
   Sort Key: (sum(o.total_amount)) DESC
   Sort Method: quicksort  Memory: 25kB
   ->  HashAggregate  (cost=3.28..3.34 rows=1 width=302) (actual time=0.052..0.055 rows=2 loops=1)
         Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
         Filter: (sum(o.total_amount) > '500'::numeric)
         Batches: 1  Memory Usage: 24kB
         Rows Removed by Filter: 1
         ->  Hash Join  (cost=2.14..3.23 rows=4 width=278) (actual time=0.037..0.041 rows=4 loops=1)
               Hash Cond: (o.customer_id = c.customer_id)
               ->  Hash Join  (cost=1.07..2.13 rows=4 width=32) (actual time=0.014..0.016 rows=4 loops=1)
                     Hash Cond: (oi.order_id = o.order_id)
                     ->  Seq Scan on order_items oi  (cost=0.00..1.04 rows=4 width=8) (actual time=0.002..0.003 rows=4 loops=1)
                     ->  Hash  (cost=1.03..1.03 rows=3 width=28) (actual time=0.005..0.005 rows=3 loops=1)
                           Buckets: 1024  Batches: 1  Memory Usage: 9kB
                           ->  Seq Scan on orders o  (cost=0.00..1.03 rows=3 width=28) (actual time=0.003..0.004 rows=3 loops=1)
               ->  Hash  (cost=1.03..1.03 rows=3 width=222) (actual time=0.014..0.014 rows=3 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 9kB
                     ->  Seq Scan on customers c  (cost=0.00..1.03 rows=3 width=222) (actual time=0.010..0.010 rows=3 loops=1)
 Planning Time: 0.568 ms
 Execution Time: 0.129 ms
(21 rows)


增加buffers参数之后的执行计划,会增加Buffers: shared hit=3 ,用于记录SQL在执行数据存取过程中使用到了多少个数据块

postgres=# explain (ANALYZE,BUFFERS)
postgres-# SELECT
postgres-#     c.customer_id,
postgres-#     c.name AS customer_name,
postgres-#     EXTRACT(YEAR FROM o.order_date) AS order_year,
postgres-#     COUNT(o.order_id) AS total_orders,
postgres-#     SUM(o.total_amount) AS total_spent,
postgres-#     COUNT(oi.order_item_id) AS total_order_items
postgres-# FROM
postgres-#     customers c
postgres-# JOIN
postgres-#     orders o ON c.customer_id = o.customer_id
postgres-# JOIN
postgres-#     order_items oi ON o.order_id = oi.order_id
postgres-# GROUP BY
postgres-#     c.customer_id, c.name, EXTRACT(YEAR FROM o.order_date)
postgres-# HAVING
postgres-#     SUM(o.total_amount) > 500
postgres-# ORDER BY
postgres-#     total_spent DESC;
                                                           QUERY PLAN                                                            
---------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=3.35..3.36 rows=1 width=302) (actual time=0.072..0.074 rows=2 loops=1)
   Sort Key: (sum(o.total_amount)) DESC
   Sort Method: quicksort  Memory: 25kB
   Buffers: shared hit=3
   ->  HashAggregate  (cost=3.28..3.34 rows=1 width=302) (actual time=0.053..0.056 rows=2 loops=1)
         Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
         Filter: (sum(o.total_amount) > '500'::numeric)
         Batches: 1  Memory Usage: 24kB
         Rows Removed by Filter: 1
         Buffers: shared hit=3
         ->  Hash Join  (cost=2.14..3.23 rows=4 width=278) (actual time=0.038..0.043 rows=4 loops=1)
               Hash Cond: (o.customer_id = c.customer_id)
               Buffers: shared hit=3
               ->  Hash Join  (cost=1.07..2.13 rows=4 width=32) (actual time=0.013..0.016 rows=4 loops=1)
                     Hash Cond: (oi.order_id = o.order_id)
                     Buffers: shared hit=2
                     ->  Seq Scan on order_items oi  (cost=0.00..1.04 rows=4 width=8) (actual time=0.003..0.004 rows=4 loops=1)
                           Buffers: shared hit=1
                     ->  Hash  (cost=1.03..1.03 rows=3 width=28) (actual time=0.005..0.005 rows=3 loops=1)
                           Buckets: 1024  Batches: 1  Memory Usage: 9kB
                           Buffers: shared hit=1
                           ->  Seq Scan on orders o  (cost=0.00..1.03 rows=3 width=28) (actual time=0.003..0.004 rows=3 loops=1)
                                 Buffers: shared hit=1
               ->  Hash  (cost=1.03..1.03 rows=3 width=222) (actual time=0.013..0.014 rows=3 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 9kB
                     Buffers: shared hit=1
                     ->  Seq Scan on customers c  (cost=0.00..1.03 rows=3 width=222) (actual time=0.009..0.010 rows=3 loops=1)
                           Buffers: shared hit=1
 Planning:
   Buffers: shared hit=2
 Planning Time: 0.247 ms
 Execution Time: 0.124 ms

增加COSTS参数之后的执行计划中增加了 I/O Timings: shared read 用于解释将数据读取缓存到缓存所需要的时间耗费

Sort  (cost=3.35..3.36 rows=1 width=302) (actual time=0.057..0.059 rows=2 loops=1)
   Sort Key: (sum(o.total_amount)) DESC
   Sort Method: quicksort  Memory: 25kB
   Buffers: shared hit=3
   ->  HashAggregate  (cost=3.28..3.34 rows=1 width=302) (actual time=0.049..0.051 rows=2 loops=1)
         Group Key: c.customer_id, EXTRACT(year FROM o.order_date)
         Filter: (sum(o.total_amount) > '500'::numeric)
         Batches: 1  Memory Usage: 24kB
         Rows Removed by Filter: 1
         Buffers: shared hit=3
         ->  Hash Join  (cost=2.14..3.23 rows=4 width=278) (actual time=0.036..0.041 rows=4 loops=1)
               Hash Cond: (o.customer_id = c.customer_id)
               Buffers: shared hit=3
               ->  Hash Join  (cost=1.07..2.13 rows=4 width=32) (actual time=0.018..0.021 rows=4 loops=1)
                     Hash Cond: (oi.order_id = o.order_id)
                     Buffers: shared hit=2
                     ->  Seq Scan on order_items oi  (cost=0.00..1.04 rows=4 width=8) (actual time=0.002..0.003 rows=4 loops=1)
                           Buffers: shared hit=1
                     ->  Hash  (cost=1.03..1.03 rows=3 width=28) (actual time=0.004..0.004 rows=3 loops=1)
                           Buckets: 1024  Batches: 1  Memory Usage: 9kB
                           Buffers: shared hit=1
                           ->  Seq Scan on orders o  (cost=0.00..1.03 rows=3 width=28) (actual time=0.002..0.003 rows=3 loops=1)
                                 Buffers: shared hit=1
               ->  Hash  (cost=1.03..1.03 rows=3 width=222) (actual time=0.011..0.011 rows=3 loops=1)
                     Buckets: 1024  Batches: 1  Memory Usage: 9kB
                     Buffers: shared hit=1
                     ->  Seq Scan on customers c  (cost=0.00..1.03 rows=3 width=222) (actual time=0.007..0.008 rows=3 loops=1)
                           Buffers: shared hit=1
 Planning:
   Buffers: shared hit=43 read=3
   I/O Timings: shared read=0.035
 Planning Time: 0.432 ms
 Execution Time: 0.114 ms

I/O Timings: shared read=0.035 表示查询过程中,从磁盘读取到共享缓冲区的数据块总耗时为 0.035 毫秒。这个时间量通常是从物理磁盘读取数据的花费。I/O 时间越短,说明磁盘 I/O 性能越好。
增加FORMAT 修改执行计划输出格式为json格式

explain (ANALYZE,BUFFERS,COSTS,VERBOSE,WAL,FORMAT JSON)
 SELECT
    c.customer_id,
    c.name AS customer_name,
    EXTRACT(YEAR FROM o.order_date) AS order_year,
    COUNT(o.order_id) AS total_orders,
    SUM(o.total_amount) AS total_spent,
    COUNT(oi.order_item_id) AS total_order_items
FROM
    customers c
JOIN
    orders o ON c.customer_id = o.customer_id
JOIN
    order_items oi ON o.order_id = oi.order_id
GROUP BY
    c.customer_id, c.name, EXTRACT(YEAR FROM o.order_date)
HAVING
    SUM(o.total_amount) > 500
ORDER BY
    total_spent DESC;

image.png

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

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

相关文章

加速功能安全AI 智能化:HIRAIN FuSa AI Agent发布

随着汽车电子电气(E/E)系统复杂性的增加,以及自动驾驶技术的迅猛发展,功能安全研发面临着日益严峻的挑战,研发成本也随之上升。面对这一挑战,经纬恒润凭借在功能安全领域的深厚积累,利用前沿的人…

页面局部使用vue等框架其它部分用JQuery进行交互

这个需求是原有django在网页需要定制一个人员签到信息。状态有三种,在岗,下班。好吧两种。但是你想 1,1.这是两次、共四个可能,00, 10,01,11.其中00是在家。10是在岗。01是。不签到只签退&#…

vue3使用element-plus手动更改url后is-active和菜单的focus颜色不同步问题

在实习,给了个需求做个新的ui界面,遇到了一个非常烦人的问题 如下,手动修改url时,is-active和focus颜色不同步 虽然可以直接让el-menu-item:focus为白色能解决这个问题,但是我就是想要有颜色哈哈哈,有些执…

一买一卖利润赛苹果,二手平台把阴阳检测玩明白了……

小柴最近看到这样一个案例,一网友在社交媒体上哭诉称,自己在某二手平台上看中了一支二手Apple pencil二代触控笔。 平台给出的检测报告显示,该产品是外观完好、功能完好接近全新的S等级产品,这位网友像捡到了宝一样,立…

不入耳开放式耳机哪个品牌好?这些品牌骨灰级开放式耳机推荐

开放式耳机以其独特的设计,不仅避免了长时间佩戴对耳朵造成的压迫感,还能让用户在享受音乐的同时保持对外界的感知,极大提升了使用安全性和舒适度。特别是对于那些长时间佩戴耳机的用户或是户外运动爱好者来说,开放式耳机无疑是一…

网页复制粘贴助手,Chrome网页复制插件(谷歌浏览器复制插件)

一款解决网页限制复制问题的插件,当你遇到限制复制粘贴和右键的网页是不是很头痛?安装这个插件后,点下插件按钮就能解决了 碰到这种情况 也是非常头疼 chrome拓展-chrome插件-强制复制 当我们浏览网页的时候,看到感兴趣的内容就…

Github 优质项目推荐(第七期)

文章目录 Github优质项目推荐 - 第七期一、【LangGPT】,5.7k stars - 让每个人都成为提示专家二、【awesome-selfhosted】,198k stars - 免费软件网络服务和 Web 应用程序列表三、【public-apis】,315k stars - 免费 API四、【JeecgBoot】&am…

校验台账生成网络事业调查表的方法

校验台账生成网络事业调查表的方法 一、打开教育事业统计调查表学校(机构)信息管理标准化台账“采集信息核查辅助工具二、导入本校台账并校验三、调查表统计导出四、完 一、打开教育事业统计调查表学校(机构)信息管理标准化台账“…

[已解决] pycharm添加本地conda虚拟环境 + 配置解释器 - pycharm找不到conda可执行文件

目录 问题: 方法: 补充:创建conda虚拟环境 参考文档:pycharm找不到conda可执行文件怎么办?-CSDN 问题: 1.显示:未为项目配置 Python 解释器 2.想在pycharm中使用本地创建的虚拟环境 方法&a…

请问医药销售智能仓系统包含哪些功能流程?

第一部分:医药销售智能仓系统功能清单 一、入库管理 货物信息录入 功能描述:支持手动输入或扫描药品包装上的条形码、二维码等,录入药品名称、规格、批次、有效期、生产厂家等信息。流程:操作人员使用扫描设备读取药品信息,系统自…

python实现屏幕录制,录音录制工具

python实现屏幕录制,录音录制工具 一,介绍 Python 实现的屏幕录制和录音录制工具是一个便捷的应用程序,旨在帮助用户同时捕捉计算机屏幕上的活动以及与之相关的音频输出。这个工具尤其针对教育工作者、内容创作者、技术支持人员以及任何需要…

uniapp使用html2canvas时,页面内的image元素模糊

不废话很简单只需要将image改成img就行 改之前 改之后 原因可能是因为uniapp里面的image标签做了某种处理

信息搜集 --子域名

1.证书查询 通过ssl证书指纹在crt.sh |证书搜索网站搜索 这些就是证书一样的 2.fofa等空间测绘平台查询 3.dns查询 https://dnsdumpster.com/ 4.威胁情报中心 360 微步等等 5.枚举 暴力破解 工具推荐:oneforall GitHub - shmilylty/OneForAll: OneForAll是一款…

QUIC(Quick UDP Internet Connections)与 RTMP(Real Time Messaging Protocol)

QUIC(Quick UDP Internet Connections)和 RTMP(Real Time Messaging Protocol)是两种不同的网络传输协议,它们在一些方面有不同的特点和应用场景。 QUIC 协议 特点 基于 UDP:QUIC 建立在 UDP 之上&#xff…

Bayes-CNN-LSTM|基于贝叶斯优化的卷积-长短期神经网络多输入数据回归预测

目录 一、程序及算法内容介绍: 基本内容: 亮点与优势: 二、实际运行效果: 三、方法原理介绍: 四、完整程序下载: 一、程序及算法内容介绍: 基本内容: 本代码基于Matlab平台编…

spark:数据的关联与合并、缓存和checkpoint

文章目录 1. 数据的关联与合并1.1 join关联1.1.1 内关联1.1.2 左关联1.1.3 右关联 1.2 Union合并 2. 缓存和checkpoint 1. 数据的关联与合并 1.1 join关联 students表数据: 1.1.1 内关联 内关联只返回两个 DataFrame 中在连接键上匹配的行。 # join 关联 from…

Microsoft Visual Studio当程序中用了try catch ,如何定位到出错的地方。

在Microsoft Visual Studio中,当用了try catch的时候,程序报错一般会抛出异常到前端,无法捕捉到源代码的地方。这时候只要设置调试就行。

java基本语法(二)

continue,break,return有什么区别 在循环结构中,当循环条件不满足或者循环次数达到要求时,循环会正常结束。但是,有时候可能需要在循环的过程中,当发生了某种条件之后 ,提前终止循环&#xff0…

安科瑞/ACREL能源管理软件能耗管理软件

综合智慧能源管理系统的参与方很多,包括电网、能源服务商、大中小微用能企业甚至个人等,这是一个需要多方参与的系统,系统要有很好的兼容性和易用性。首先,系统的设计需要支持多种工业接口的应用,如第三方系统接口、智能感知设备接口以及用能…

【从零开始的LeetCode-算法】3195. 包含所有 1 的最小矩形面积 I

给你一个二维 二进制 数组 grid。请你找出一个边在水平方向和竖直方向上、面积 最小 的矩形,并且满足 grid 中所有的 1 都在矩形的内部。 返回这个矩形可能的 最小 面积。 示例 1: 输入: grid [[0,1,0],[1,0,1]] 输出: 6 解释&…