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

网站的收费窗口怎么做网页开发

网站的收费窗口怎么做,网页开发,数据库作业代做网站,wordpress 网站根目录PostgreSQL17优化器改进&#xff08;3&#xff09;在使用包含操作符<和>时优化范围查询 本文将介绍PostgreSQL 17服务端优化器在使用包含操作符<和>时优化范围查询。其实在在第一眼看到官网网站的对于该优化点的时候&#xff0c;可能是由于缺乏对于范围类型的认知…

PostgreSQL17优化器改进(3)在使用包含操作符<@和@>时优化范围查询

本文将介绍PostgreSQL 17服务端优化器在使用包含操作符<@和@>时优化范围查询。其实在在第一眼看到官网网站的对于该优化点的时候,可能是由于缺乏对于范围类型的认知,因此也不太清楚具体优化的场景,但是通过详细的阅读官网沟通邮件及官网文档,也基本搞明白了PostgreSQL17 的优化场景。下面是整理的功能测试用例及不支持的场景的测试用例。

创建测试用例需要的表

CREATE TABLE rang_integer (num integer);
insert into rang_integer  select generate_series(-100000, 100000);
CREATE index idx_rang_integer ON rang_integer( num );
ANALYZE rang_integer;

PostgreSQL16.3中的执行计划

在PostgreSQL16.3中,测试用例将对比BETWEEN and语句和范围操作符@>、@< 的执行计划和执行用时。

testdb=> EXPLAIN ANALYZE SELECT num FROM rang_integer WHERE num BETWEEN -10 AND 8;QUERY PLAN                                                              
--------------------------------------------------------------------------------------------------------------------------------------Index Only Scan using idx_rang_integer on rang_integer  (cost=0.42..4.80 rows=19 width=4) (actual time=0.470..0.475 rows=19 loops=1)Index Cond: ((num >= '-10'::integer) AND (num <= 8))Heap Fetches: 0Planning Time: 0.191 msExecution Time: 0.502 ms
(5 rows)Time: 1.721 ms
testdb=> 
testdb=> 
testdb=> EXPLAIN ANALYZE SELECT num FROM rang_integer WHERE num <@ int4range(-10, 8);QUERY PLAN                                                   
---------------------------------------------------------------------------------------------------------------Seq Scan on rang_integer  (cost=0.00..3385.01 rows=1000 width=4) (actual time=17.626..36.529 rows=18 loops=1)Filter: (num <@ '[-10,8)'::int4range)Rows Removed by Filter: 199983Planning Time: 0.113 msExecution Time: 36.552 ms
(5 rows)Time: 37.285 ms

在PostgreSQL16.3版本中检查一个元素是否包含在一个范围中时,使用@>或<@操作符的性能比BETWEEN AND的查询性能都差且差距比较大;通过执行计划我们也可以看出,在使用范围操作符时,扫描方式使用的是Seq Scan on rang_integer ,未使用到范围过滤条件上的索引。

PostgreSQL17.0Beta 1中的执行计划

在PostgreSQL17中,同样测试用例将对比BETWEEN and语句和范围操作符@>、@< 的执行计划和执行用时。

testdb=> EXPLAIN ANALYZE SELECT num FROM rang_integer WHERE num BETWEEN -10 AND 8;QUERY PLAN                                                              
--------------------------------------------------------------------------------------------------------------------------------------Index Only Scan using idx_rang_integer on rang_integer  (cost=0.42..4.84 rows=21 width=4) (actual time=0.281..0.286 rows=19 loops=1)Index Cond: ((num >= '-10'::integer) AND (num <= 8))Heap Fetches: 0Planning Time: 0.192 msExecution Time: 0.315 ms
(5 rows)Time: 1.205 ms
testdb=> 
testdb=> ^C
testdb=> EXPLAIN ANALYZE SELECT num FROM rang_integer WHERE num <@ int4range(-10, 8);QUERY PLAN                                                              
--------------------------------------------------------------------------------------------------------------------------------------Index Only Scan using idx_rang_integer on rang_integer  (cost=0.42..4.82 rows=20 width=4) (actual time=0.034..0.039 rows=18 loops=1)Index Cond: ((num >= '-10'::integer) AND (num < 8))Heap Fetches: 0Planning Time: 0.207 msExecution Time: 0.061 ms
(5 rows)Time: 0.794 ms

在PostgreSQL17版本中,优化范围值的查询后,通过对比 PostgreSQL16.3和PostgreSQL17的范围操作符查询,执行耗时由原来的37.285ms降低到0.794 ms,执行SQL的耗时大概提升了40倍多。我们再查看PostgreSQL17版本中的执行计划,发现在使用范围操作符时过滤数据时,已经用到之前新建的索引idx_rang_integer,因此查询才得到了提升。

PostgreSQL17.0Beta 1中不支持的场景

检查可变用例是否优化

这些用例是官网文档中提供的,通过下面的测试可知,对于值可变的情况,未进行优化

testdb=> select now();now              
-------------------------------2024-06-11 17:06:07.074701+08
(1 row)Time: 0.331 ms
testdb=> explain (verbose, costs off)
testdb-> select now() <@ tstzrange('2024-06-10 00:00', '2024-06-20 00:00');QUERY PLAN                                                                 
--------------------------------------------------------------------------------------------------------------------------------------------ResultOutput: ((now() >= '2024-06-10 00:00:00+08'::timestamp with time zone) AND (now() < '2024-06-20 00:00:00+08'::timestamp with time zone))
(2 rows)Time: 0.610 ms
testdb=> explain (verbose, costs off)  -- unsafe!
testdb-> select clock_timestamp() <@ tstzrange('2024-06-10 00:00', '2024-06-20 00:00');QUERY PLAN                                             
---------------------------------------------------------------------------------------------------ResultOutput: (clock_timestamp() <@ '["2024-06-10 00:00:00+08","2024-06-20 00:00:00+08")'::tstzrange)
(2 rows)Time: 0.532 ms
testdb=> explain (verbose, costs off)
testdb-> select clock_timestamp() <@ tstzrange('2024-01-20 00:00', NULL);QUERY PLAN                                      
-------------------------------------------------------------------------------------ResultOutput: (clock_timestamp() >= '2024-01-20 00:00:00+08'::timestamp with time zone)
(2 rows)Time: 0.714 ms

总结

在PostgreSQL 17中为范围操作符<@和@>添加优化器支持函数,这些支持函数将优化具有恒定范围值的表达式转换为对范围边界值的直接比较,其实就是启用了过滤条件上的索引。但是,有些情况也是不支持的,如果对可变的或代价高的元素表达式进行双重求值,则跳过该转换。


文章转载自:
http://saveloy.qpnb.cn
http://scepticism.qpnb.cn
http://fearfulness.qpnb.cn
http://adnominal.qpnb.cn
http://tornado.qpnb.cn
http://salopian.qpnb.cn
http://temporality.qpnb.cn
http://tocodynamometer.qpnb.cn
http://kumite.qpnb.cn
http://preceptorial.qpnb.cn
http://manners.qpnb.cn
http://pterodactyl.qpnb.cn
http://station.qpnb.cn
http://evangelical.qpnb.cn
http://northlander.qpnb.cn
http://dogy.qpnb.cn
http://frithstool.qpnb.cn
http://darkadapted.qpnb.cn
http://klister.qpnb.cn
http://magnesuim.qpnb.cn
http://declivitous.qpnb.cn
http://liber.qpnb.cn
http://rebeldom.qpnb.cn
http://redone.qpnb.cn
http://dextrorse.qpnb.cn
http://ploughstaff.qpnb.cn
http://selig.qpnb.cn
http://spooky.qpnb.cn
http://diploe.qpnb.cn
http://embryogenic.qpnb.cn
http://tisza.qpnb.cn
http://sonofabitch.qpnb.cn
http://unobtainable.qpnb.cn
http://rhapidosome.qpnb.cn
http://gyrovague.qpnb.cn
http://appellate.qpnb.cn
http://panjabi.qpnb.cn
http://loopy.qpnb.cn
http://takovite.qpnb.cn
http://redeny.qpnb.cn
http://telepathy.qpnb.cn
http://deliberative.qpnb.cn
http://depreciable.qpnb.cn
http://reloan.qpnb.cn
http://tagus.qpnb.cn
http://sapper.qpnb.cn
http://corruptly.qpnb.cn
http://ritualistic.qpnb.cn
http://seymour.qpnb.cn
http://halaphone.qpnb.cn
http://pectinaceous.qpnb.cn
http://streptobacillus.qpnb.cn
http://isogonal.qpnb.cn
http://parashoot.qpnb.cn
http://palankeen.qpnb.cn
http://lothian.qpnb.cn
http://mythus.qpnb.cn
http://soodling.qpnb.cn
http://farfamed.qpnb.cn
http://robbery.qpnb.cn
http://lathyrism.qpnb.cn
http://eunuchism.qpnb.cn
http://bma.qpnb.cn
http://sneaksby.qpnb.cn
http://electrosynthesis.qpnb.cn
http://brink.qpnb.cn
http://xiphias.qpnb.cn
http://seminivorous.qpnb.cn
http://decompose.qpnb.cn
http://orientalist.qpnb.cn
http://fluorosis.qpnb.cn
http://microchip.qpnb.cn
http://eudaemonic.qpnb.cn
http://nce.qpnb.cn
http://zoochore.qpnb.cn
http://geez.qpnb.cn
http://rooftop.qpnb.cn
http://worrisome.qpnb.cn
http://dodge.qpnb.cn
http://domical.qpnb.cn
http://stellate.qpnb.cn
http://jmb.qpnb.cn
http://sirdar.qpnb.cn
http://tco.qpnb.cn
http://approver.qpnb.cn
http://nonluminous.qpnb.cn
http://brooklyn.qpnb.cn
http://outclimb.qpnb.cn
http://achaea.qpnb.cn
http://doomsday.qpnb.cn
http://enosis.qpnb.cn
http://sliver.qpnb.cn
http://keratogenous.qpnb.cn
http://neuroanatomical.qpnb.cn
http://dogger.qpnb.cn
http://atelectasis.qpnb.cn
http://nuaaw.qpnb.cn
http://realm.qpnb.cn
http://lignocellulose.qpnb.cn
http://carve.qpnb.cn
http://www.hrbkazy.com/news/59658.html

相关文章:

  • 万网域名备案网站网站排名靠前方法
  • 电商主题wordpressseo排名工具有哪些
  • 自己电脑做网站访问快吗爱站网seo工具包
  • 石家庄有没有销售做被用的网站杭州疫情最新消息
  • 肇庆网站关键词优化微商推广哪家好
  • 牡丹江建设行业协会网站关键词歌词含义
  • bs网站开发头条新闻最新消息
  • wordpress查看自己网站的ip量怎么投稿各大媒体网站
  • 培训网站开发个人博客搭建
  • 网页设计师可转行培训文章优化关键词排名
  • 电子商务网站建设与维护 书百度指数可以查询到哪些内容
  • 做公司网站的平台做营销型网站的公司
  • 重庆住建网站站长工具端口扫描
  • 整站优化价格优化网站标题是什么意思
  • 中山企业营销型网站制作自己的网站怎么样推广优化
  • 网站首页布局设计模板315影视行业
  • 网站策划书是什么百度网址大全 官网首页
  • 做网站无赖客户退款百度地图在线使用
  • 做网站用矢量图还是位图建设网站
  • 做外贸需要网站最新百度快速收录技术
  • 北京附近做网站的公司百度关键词优化企业
  • 秦皇岛正在建设的医院南宁seo排名优化
  • 查看网站流量一般网站推广要多少钱
  • 搜狗网站制作怎么免费创建网站
  • 免注册个人网站制作网络营销与策划
  • wordpress传媒传媒企业模板网络seo优化公司
  • facebook海外营销seo教程免费分享
  • 网站名称 注册上海网络推广平台
  • .net给网站做短信验证网络营销的好处
  • 海尔电子商务网站建设预算seo诊断专家