爆款云主机2核4G限时秒杀,88元/年起!
查看详情

活动

天翼云最新优惠活动,涵盖免费试用,产品折扣等,助您降本增效!
热门活动
  • 618智算钜惠季 爆款云主机2核4G限时秒杀,88元/年起!
  • 免费体验DeepSeek,上天翼云息壤 NEW 新老用户均可免费体验2500万Tokens,限时两周
  • 云上钜惠 HOT 爆款云主机全场特惠,更有万元锦鲤券等你来领!
  • 算力套餐 HOT 让算力触手可及
  • 天翼云脑AOne NEW 连接、保护、办公,All-in-One!
  • 中小企业应用上云专场 产品组合下单即享折上9折起,助力企业快速上云
  • 息壤高校钜惠活动 NEW 天翼云息壤杯高校AI大赛,数款产品享受线上订购超值特惠
  • 天翼云电脑专场 HOT 移动办公新选择,爆款4核8G畅享1年3.5折起,快来抢购!
  • 天翼云奖励推广计划 加入成为云推官,推荐新用户注册下单得现金奖励
免费活动
  • 免费试用中心 HOT 多款云产品免费试用,快来开启云上之旅
  • 天翼云用户体验官 NEW 您的洞察,重塑科技边界

智算服务

打造统一的产品能力,实现算网调度、训练推理、技术架构、资源管理一体化智算服务
智算云(DeepSeek专区)
科研助手
  • 算力商城
  • 应用商城
  • 开发机
  • 并行计算
算力互联调度平台
  • 应用市场
  • 算力市场
  • 算力调度推荐
一站式智算服务平台
  • 模型广场
  • 体验中心
  • 服务接入
智算一体机
  • 智算一体机
大模型
  • DeepSeek-R1-昇腾版(671B)
  • DeepSeek-R1-英伟达版(671B)
  • DeepSeek-V3-昇腾版(671B)
  • DeepSeek-R1-Distill-Llama-70B
  • DeepSeek-R1-Distill-Qwen-32B
  • Qwen2-72B-Instruct
  • StableDiffusion-V2.1
  • TeleChat-12B

应用商城

天翼云精选行业优秀合作伙伴及千余款商品,提供一站式云上应用服务
进入甄选商城进入云市场创新解决方案
办公协同
  • WPS云文档
  • 安全邮箱
  • EMM手机管家
  • 智能商业平台
财务管理
  • 工资条
  • 税务风控云
企业应用
  • 翼信息化运维服务
  • 翼视频云归档解决方案
工业能源
  • 智慧工厂_生产流程管理解决方案
  • 智慧工地
建站工具
  • SSL证书
  • 新域名服务
网络工具
  • 翼云加速
灾备迁移
  • 云管家2.0
  • 翼备份
资源管理
  • 全栈混合云敏捷版(软件)
  • 全栈混合云敏捷版(一体机)
行业应用
  • 翼电子教室
  • 翼智慧显示一体化解决方案

合作伙伴

天翼云携手合作伙伴,共创云上生态,合作共赢
天翼云生态合作中心
  • 天翼云生态合作中心
天翼云渠道合作伙伴
  • 天翼云代理渠道合作伙伴
天翼云服务合作伙伴
  • 天翼云集成商交付能力认证
天翼云应用合作伙伴
  • 天翼云云市场合作伙伴
  • 天翼云甄选商城合作伙伴
天翼云技术合作伙伴
  • 天翼云OpenAPI中心
  • 天翼云EasyCoding平台
天翼云培训认证
  • 天翼云学堂
  • 天翼云市场商学院
天翼云合作计划
  • 云汇计划
天翼云东升计划
  • 适配中心
  • 东升计划
  • 适配互认证

开发者

开发者相关功能入口汇聚
技术社区
  • 专栏文章
  • 互动问答
  • 技术视频
资源与工具
  • OpenAPI中心
开放能力
  • EasyCoding敏捷开发平台
培训与认证
  • 天翼云学堂
  • 天翼云认证
魔乐社区
  • 魔乐社区

支持与服务

为您提供全方位支持与服务,全流程技术保障,助您轻松上云,安全无忧
文档与工具
  • 文档中心
  • 新手上云
  • 自助服务
  • OpenAPI中心
定价
  • 价格计算器
  • 定价策略
基础服务
  • 售前咨询
  • 在线支持
  • 在线支持
  • 工单服务
  • 建议与反馈
  • 用户体验官
  • 服务保障
  • 客户公告
  • 会员中心
增值服务
  • 红心服务
  • 首保服务
  • 客户支持计划
  • 专家技术服务
  • 备案管家

了解天翼云

天翼云秉承央企使命,致力于成为数字经济主力军,投身科技强国伟大事业,为用户提供安全、普惠云服务
品牌介绍
  • 关于天翼云
  • 智算云
  • 天翼云4.0
  • 新闻资讯
  • 天翼云APP
基础设施
  • 全球基础设施
  • 信任中心
最佳实践
  • 精选案例
  • 超级探访
  • 云杂志
  • 分析师和白皮书
  • 天翼云·创新直播间
市场活动
  • 2025智能云生态大会
  • 2024智算云生态大会
  • 2023云生态大会
  • 2022云生态大会
  • 天翼云中国行
天翼云
  • 活动
  • 智算服务
  • 产品
  • 解决方案
  • 应用商城
  • 合作伙伴
  • 开发者
  • 支持与服务
  • 了解天翼云
      • 文档
      • 控制中心
      • 备案
      • 管理中心

      mysql/stonedb-慢SQL-出现问题的SQL-Q2

      首页 知识中心 数据库 文章详情页

      mysql/stonedb-慢SQL-出现问题的SQL-Q2

      2023-05-22 08:07:04 阅读次数:485

      mysql,stonedb

      摘要:

      记录经过优化后出现问题的SQL

      优化后出现问题的SQL

      Q2:

      select
      s_acctbal,
      s_name,
      n_name,
      p_partkey,
      p_mfgr,
      s_address,
      s_phone,
      s_comment
      from
      part,
      supplier,
      partsupp,
      nation,
      region
      where
      p_partkey = ps_partkey
      and s_suppkey = ps_suppkey
      and p_size = 15
      and p_type like '%BRASS'
      and s_nationkey = n_nationkey
      and n_regionkey = r_regionkey
      and r_name = 'EUROPE'
      and ps_supplycost = (
      select
      min(ps_supplycost)
      from
      partsupp,
      supplier,
      nation,
      region
      where
      p_partkey = ps_partkey
      and s_suppkey = ps_suppkey
      and s_nationkey = n_nationkey
      and n_regionkey = r_regionkey
      and r_name = 'EUROPE'
      )
      order by
      s_acctbal desc,
      n_name,
      s_name,
      p_partkey
      limit 100;

      问题:

      查出结果为空

      对比下mysql8的查询结果:

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = (
      -> select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> )
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 100;
      +-----------+--------------------+----------------+-----------+----------------+------------------------------------------+-----------------+------------------------------------------------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+----------------+-----------+----------------+------------------------------------------+-----------------+------------------------------------------------------------------------------------------------------+
      | 9994.37 | Supplier#000030084 | GERMANY | 380077 | Manufacturer#5 | gBEvSkyW o1uHea0CV,oHtkTTVW | 17-519-171-6883 | pinto beans sleep fluffily alongside of the slyly special deposits. slyly pendi |
      | 9992.54 | Supplier#000099650 | RUSSIA | 824625 | Manufacturer#3 | ySI FMlh9gHkEDN6gQWf3 | 32-971-481-2533 | ged deposits cajole carefully packages. carefully final ideas affix furiously. regu |
      | 9987.51 | Supplier#000020657 | ROMANIA | 395653 | Manufacturer#5 | 4pL,8BT3Yun,17QHqAr9 A,ZFyyuH4L | 29-167-460-7830 | otes. excuses behind the blithely regular packages are furio |
      | 9986.40 | Supplier#000082995 | RUSSIA | 1782994 | Manufacturer#5 | CXiBNZ6DUBjgY | 32-510-919-3096 | nding instructions boost. unusual, regular asymptotes above the fluffily express e |
      | 9984.69 | Supplier#000008875 | ROMANIA | 633856 | Manufacturer#4 | hRdOqKqyU,sHq | 29-132-904-4395 | ong the bold pinto beans are furiously blithely slow |
      | 9984.30 | Supplier#000081977 | RUSSIA | 1356963 | Manufacturer#5 | gemeY46TI2J6ZAt9gjouxB | 32-569-570-6149 | ng to the furiously special package |
      | 9983.76 | Supplier#000024757 | RUSSIA | 599751 | Manufacturer#4 | vJb,kFRqwsv34H5Y6GsRAEJXz0VCZ | 32-868-781-9721 | nal foxes. theodolites cajole regular, final grouches. unusual, final theodolites lose |
      | 9980.25 | Supplier#000067392 | RUSSIA | 192388 | Manufacturer#2 | oEQvrLi316,0I7Z | 32-872-236-1034 | nal pinto beans cajole quickly. final excuses about the deposits |
      | 9974.93 | Supplier#000072260 | ROMANIA | 397250 | Manufacturer#3 | ijrpECIzgkK,qi83qjKtf0qhMX4O3i17i | 29-745-482-4154 | its above the special deposits engage slyly among the unusual, even asymptotes. carefull |
      | 9971.99 | Supplier#000016715 | FRANCE | 691708 | Manufacturer#2 | BjEu56DmMNx VHZ | 16-401-454-3384 | even requests; fluffily ironic |
      | 9968.96 | Supplier#000085431 | ROMANIA | 1885430 | Manufacturer#4 | 1hhUdxO7AVH | 29-402-887-2528 | boost furiously blithely quiet requests. ironic, ironic instructions haggle slowly. ironic, un |
      | 9967.60 | Supplier#000028837 | ROMANIA | 228836 | Manufacturer#2 | gAaNbDxVTyFjjhgGodAKyy9uk | 29-105-576-2294 | hins must have to haggle blithely along |
      | 9967.60 | Supplier#000028837 | ROMANIA | 1828836 | Manufacturer#4 | gAaNbDxVTyFjjhgGodAKyy9uk | 29-105-576-2294 | hins must have to haggle blithely along |
      | 9966.67 | Supplier#000030306 | UNITED KINGDOM | 1280281 | Manufacturer#3 | y2Pslsn3B1KRWYKtcwMMcOzYZUel4ox5Rzp | 33-758-232-4917 | lyly special packages around the |
      | 9962.57 | Supplier#000034645 | ROMANIA | 759623 | Manufacturer#4 | eX2phCtgj8wVd8U7oWYs6bQOayC | 29-629-100-1429 | uests sleep carefully besides the patterns. carefully regular forges |
      | 9957.83 | Supplier#000012588 | ROMANIA | 12587 | Manufacturer#1 | 8cRzJOxCG7z qpfkXKgrQs6ubfOTK | 29-373-772-7126 | uriously ironic platelets nag. slyly bold instructions haggle furiously fluffil |
      | 9956.67 | Supplier#000074260 | FRANCE | 124257 | Manufacturer#2 | W83 2W,pP8sFtnVxjOJC1a7zO5 | 16-511-538-8136 | yly ironic ideas try to are! final platelets above the final |
      | 9945.36 | Supplier#000036819 | ROMANIA | 761797 | Manufacturer#4 | NJfzlpQ4TqMDtYWAjXM9kFSjqTs7ZnIwHmUvT | 29-370-897-9499 | al accounts. carefully ruthless requests haggle blithely express depos |
      | 9944.02 | Supplier#000010019 | ROMANIA | 1810018 | Manufacturer#4 | 6fy8i iDm,kCwJfaiNRZtVWeAtrLnQT | 29-695-919-1392 | y regular excuses are blithely special theodolites. final excuses sleep |
      | 9942.90 | Supplier#000019177 | GERMANY | 494172 | Manufacturer#5 | TUINeTTQPDi7DOcYue | 17-316-670-1231 | s wake furiously according to the depths. slyly express |
      | 9940.76 | Supplier#000031587 | GERMANY | 556571 | Manufacturer#5 | qOjHNzlw4i7XT7tr7JU2P2rY3d | 17-221-164-2555 | ect fluffily. fluffily even instructions sleep quickly careful |
      | 9939.40 | Supplier#000028113 | RUSSIA | 428112 | Manufacturer#2 | HrnOoqKBep02Dvafwz9SHIzaJWlL | 32-938-722-6528 | ideas. ruthlessly ironic accounts should are slyly special, regular pla |
      | 9939.40 | Supplier#000028113 | RUSSIA | 1253076 | Manufacturer#5 | HrnOoqKBep02Dvafwz9SHIzaJWlL | 32-938-722-6528 | ideas. ruthlessly ironic accounts should are slyly special, regular pla |
      | 9938.69 | Supplier#000048337 | RUSSIA | 1448336 | Manufacturer#5 | tXGAix6fSBfdQuOu4BBAQDsnVsCzxzFK8g1 | 32-566-156-5537 | ular pinto beans. slyly express theodolites sleep blithely |
      | 9938.58 | Supplier#000094826 | FRANCE | 1494825 | Manufacturer#4 | 2QpjZspOzpdUre9zk9,IoeNDxm2 | 16-253-529-1094 | ideas. ruthlessly sly package |
      | 9937.53 | Supplier#000042994 | GERMANY | 1442993 | Manufacturer#3 | Q,AdU5BqQwPC2rGbrydanSbbEU6PoTPf | 17-429-634-1843 | aggle carefully along the quickly even |
      | 9936.01 | Supplier#000064630 | FRANCE | 1289593 | Manufacturer#5 | cW3kNfLGiN2n7w84pIHEpTd4sewgpnW | 16-782-698-5265 | . furiously express ideas boost across the regular requests. furiously final ideas haggle fl |
      | 9936.00 | Supplier#000042253 | ROMANIA | 142252 | Manufacturer#4 | r9uqFbAWydd4tcgzcS RI Y | 29-148-772-1827 | lar packages haggle. blithely ir |
      | 9934.88 | Supplier#000096830 | FRANCE | 621811 | Manufacturer#3 | Kr0JO9SLORE9w jyf0SmllIw6z4TwSWMM qbLG | 16-418-502-3708 | theodolites sublate. quickly unusual theodolites according to the regular, ironic |
      | 9934.44 | Supplier#000009762 | GERMANY | 1234725 | Manufacturer#4 | sszbnlE,8rTVV1n5PUnUaX | 17-758-315-1893 | uriously unusual foxes. bold, ironic foxes according to the blithely final |
      | 9932.47 | Supplier#000068671 | UNITED KINGDOM | 568670 | Manufacturer#1 | KxbfreN6sK oIUYlebYYCDveczKvlNjPZ2GBZmZ | 33-345-114-7234 | final foxes sleep carefully. final, ironic pinto beans after the special deposits h |
      | 9923.62 | Supplier#000037153 | UNITED KINGDOM | 562137 | Manufacturer#1 | sU34QleurYe 2uU9bQO,O Zg4yiKw6NDEy,fu | 33-691-756-3666 | special ideas need to detect quickly final dependencies. furiously regular packages above the sl |
      | 9920.24 | Supplier#000051485 | GERMANY | 1376445 | Manufacturer#2 | ZrSnSNxfvsD8KBgRrZzHKm,wrv2DtPf3 | 17-317-540-3763 | -- slyly even escapades sleep carefully a |
      | 9918.88 | Supplier#000082683 | UNITED KINGDOM | 1932644 | Manufacturer#1 | RR7y BiYXqJaw | 33-114-482-3385 | nding instructions along the blithely regular ideas affix according to the ironic requests. careful |
      | 9915.38 | Supplier#000006085 | ROMANIA | 1506084 | Manufacturer#5 | T3Ju68MUhIb2hpTO3f8OGG | 29-528-113-9241 | iously bold sauternes. slyly regular asymptotes |
      | 9909.28 | Supplier#000066602 | GERMANY | 1341588 | Manufacturer#2 | HK9pwZa9eIhUuatBkdSGzqobKxSwTlI h,GoXX | 17-803-997-4487 | ideas are slyly final ideas. quickly ironic |
      | 9909.28 | Supplier#000066602 | GERMANY | 1791550 | Manufacturer#3 | HK9pwZa9eIhUuatBkdSGzqobKxSwTlI h,GoXX | 17-803-997-4487 | ideas are slyly final ideas. quickly ironic |
      | 9902.07 | Supplier#000075736 | RUSSIA | 650729 | Manufacturer#2 | 2AtAHp8CVxxvbVBEv0wTjQNxtS99HlJ | 32-923-189-5079 | oxes wake furiously carefully final foxes. slyly |
      | 9900.50 | Supplier#000059434 | UNITED KINGDOM | 59433 | Manufacturer#3 | j8s26GZ4EF6vzq9oIRsspI2zt Usst | 33-696-691-9604 | regular foxes throughout the p |
      | 9898.61 | Supplier#000059419 | FRANCE | 1509388 | Manufacturer#2 | Czn 4yp4BFP3cdO9KVpcEVKfF4 | 16-660-798-1130 | y regular accounts. quickly dogged Tiresias across the blithely pending theodolit |
      | 9897.41 | Supplier#000017795 | UNITED KINGDOM | 667782 | Manufacturer#5 | A5a1lovY,yQoSHaYon5cGgo1l | 33-398-227-1033 | express accounts haggle blithely. furiously ironic requests cajole quickly. quickly final fo |
      | 9892.10 | Supplier#000042566 | RUSSIA | 992547 | Manufacturer#2 | bpLCiCVwl6uxYR | 32-550-577-4769 | inal platelets against the requests detect according to the carefully express in |
      | 9892.10 | Supplier#000042566 | RUSSIA | 1217553 | Manufacturer#5 | bpLCiCVwl6uxYR | 32-550-577-4769 | inal platelets against the requests detect according to the carefully express in |
      | 9888.93 | Supplier#000090097 | RUSSIA | 515081 | Manufacturer#1 | x OQ8Y TUEzuI | 32-748-779-9791 | eas sublate furiously final excuse |
      | 9884.84 | Supplier#000082184 | UNITED KINGDOM | 1907126 | Manufacturer#2 | 2UNwl4Atkn | 33-406-348-8224 | ual dependencies try to sleep furiously inside the quickly spe |
      | 9884.20 | Supplier#000068361 | GERMANY | 1968360 | Manufacturer#2 | MRev0hTbR9Y5xEPUZxM28 | 17-385-307-2876 | gular asymptotes sleep slyly |
      | 9880.10 | Supplier#000042667 | GERMANY | 817658 | Manufacturer#5 | 4fQZB7L5eZDVs | 17-847-751-8418 | ly final packages alongside of the unus |
      | 9878.75 | Supplier#000028803 | RUSSIA | 1478774 | Manufacturer#1 | f1mPa2ts2TUCbZ9UVmuDuu2lXLgfYTP | 32-220-759-7420 | y final accounts. blithely silent deposits doubt blithely. carefully pending ide |
      | 9878.75 | Supplier#000028803 | RUSSIA | 1703785 | Manufacturer#4 | f1mPa2ts2TUCbZ9UVmuDuu2lXLgfYTP | 32-220-759-7420 | y final accounts. blithely silent deposits doubt blithely. carefully pending ide |
      | 9875.72 | Supplier#000073719 | FRANCE | 1898664 | Manufacturer#2 | PiOw jtgZx,FXj iaUxNmxVEyVo77IjYqACcjk | 16-823-901-3878 | wake slyly about the ironic, ironic accounts. fluffily express |
      | 9874.90 | Supplier#000040624 | GERMANY | 140623 | Manufacturer#1 | 4S0T3NXSEFH2VzqIwkvbItm3eFFe0iWpwbV19SFz | 17-233-896-4431 | haggle closely across the slyly fluf |
      | 9873.90 | Supplier#000058391 | GERMANY | 508380 | Manufacturer#3 | FA 45I,q ODAcIxWEE4 Gb,m1p5eFW2sCoclCLs | 17-311-740-7234 | al, regular platelets. ironic deposits haggle slyly against the bo |
      | 9872.81 | Supplier#000097316 | ROMANIA | 272313 | Manufacturer#4 | cJ7G0pfLTWOAp4QFtksmmGR1CTCI | 29-726-802-1880 | ts sleep fluffily. carefully regular deposits alongside o |
      | 9871.22 | Supplier#000006373 | GERMANY | 556362 | Manufacturer#5 | J8fcXWsTqM | 17-813-485-8637 | etect blithely bold asymptotes. fluffily ironic platelets wake furiously; blit |
      | 9870.58 | Supplier#000027835 | ROMANIA | 1977796 | Manufacturer#3 | rQNlJWtDotXE8GK5FXID,jbkVsRFB87ZUZyK | 29-103-673-6501 | heodolites. regular packages cajole. |
      | 9869.98 | Supplier#000081446 | FRANCE | 556440 | Manufacturer#1 | xQnnVgu PfVo | 16-912-320-8438 | nal dependencies. pinto beans |
      | 9869.66 | Supplier#000016553 | ROMANIA | 291550 | Manufacturer#4 | MBv6xbbVlLii9w9b5uBo | 29-212-862-7077 | eposits sleep pinto beans. deposits eat ironically. carefully silent courts against the slyly silent |
      | 9868.44 | Supplier#000062507 | ROMANIA | 1862506 | Manufacturer#5 | 1dePPGFWYYK | 29-895-360-4525 | ependencies solve slyly. slyly unusual accounts detect blithe, express requests. furiously |
      | 9865.69 | Supplier#000011713 | ROMANIA | 511712 | Manufacturer#1 | z21Y9930sRTsTgOIo omLTfWderX82DVdPVsgs | 29-368-999-1073 | ccounts haggle quickly. blithely even accounts boost according to the blithely express pack |
      | 9860.62 | Supplier#000022993 | ROMANIA | 1447950 | Manufacturer#4 | PQI K09e2jt,pfHRHzN1,lhY3Vkwlf | 29-602-372-7262 | nto beans. special asymptotes cajole after the bli |
      | 9860.24 | Supplier#000029047 | FRANCE | 154043 | Manufacturer#2 | 9YOTHZrVjWbI6nF1P | 16-229-827-8211 | kly. fluffily special theodolites along the busily |
      | 9859.93 | Supplier#000052771 | ROMANIA | 602758 | Manufacturer#5 | rdFyHz5FV1FCi2jmFFCZAPlPyH xevioB | 29-926-286-5299 | among the packages cajole carefully ironic dugouts. fluffily final pinto b |
      | 9856.43 | Supplier#000045738 | UNITED KINGDOM | 645737 | Manufacturer#3 | qd7jaGTfaxX Fhamq84AagYXv3IqU0oIEjBC | 33-394-523-3413 | es. fluffy deposits run caref |
      | 9852.52 | Supplier#000008973 | RUSSIA | 483968 | Manufacturer#3 | t5L67YdBYYH6o,Vz24jpDyQ9 | 32-188-594-7038 | rns wake final foxes. carefully unusual depende |
      | 9850.90 | Supplier#000066053 | UNITED KINGDOM | 441048 | Manufacturer#1 | C,IWe7RpG WHdg2ZS | 33-766-582-8615 | final, ironic requests cajole fluffily blithely reg |
      | 9850.90 | Supplier#000066053 | UNITED KINGDOM | 916034 | Manufacturer#3 | C,IWe7RpG WHdg2ZS | 33-766-582-8615 | final, ironic requests cajole fluffily blithely reg |
      | 9850.15 | Supplier#000062925 | FRANCE | 512914 | Manufacturer#2 | aXKdkhctDBlg, | 16-757-400-1683 | its. blithely regular platelets outside the slyly iro |
      | 9849.09 | Supplier#000034097 | FRANCE | 609090 | Manufacturer#1 | PRUY1riC CmZl90q0AEl | 16-172-883-1928 | ounts. blithely busy requests affix about the final requests. blithely regular accounts use aga |
      | 9849.06 | Supplier#000021254 | GERMANY | 1796236 | Manufacturer#5 | 9Q,ItS4plqXR7HCHkG3Pkm5BM | 17-623-110-6693 | dogged requests wake furiously. regular, r |
      | 9848.73 | Supplier#000091096 | UNITED KINGDOM | 1566080 | Manufacturer#3 | jmrZln1W,XSTx Rbwq,N1eR8 | 33-848-379-3222 | o the quickly pending excuses; dependencie |
      | 9846.72 | Supplier#000062848 | UNITED KINGDOM | 1937828 | Manufacturer#1 | X,xtORbtbgOKftLdqgigKBdjFQgPprW,GG | 33-325-481-7818 | among the carefully special deposits. deposits shall detect regular packages. bold packages cajol |
      | 9837.53 | Supplier#000005414 | RUSSIA | 1905413 | Manufacturer#3 | yDLmG4bxYA1iviZ71PkEtzcDoB0KT | 32-204-830-9105 | y through the fluffily ruthless platelets; furiously si |
      | 9837.43 | Supplier#000046552 | FRANCE | 1121540 | Manufacturer#2 | ,cgeykS01djUU95zLM2Hpe | 16-424-132-3669 | inal requests boost slyly pending pinto beans. unusual, |
      | 9835.16 | Supplier#000029961 | UNITED KINGDOM | 754939 | Manufacturer#4 | gHq2sGgnKZl | 33-411-329-7177 | s. ideas boost around the carefully |
      | 9831.95 | Supplier#000057380 | ROMANIA | 1682331 | Manufacturer#5 | OISAlNhoacPOx | 29-915-260-4712 | ans wake special, special ideas. r |
      | 9825.33 | Supplier#000089770 | ROMANIA | 1414727 | Manufacturer#3 | R0u11qwGLDTo8M7t | 29-209-173-8510 | along the enticingly bold accounts-- furiou |
      | 9824.72 | Supplier#000072517 | ROMANIA | 1097486 | Manufacturer#2 | OFw3m2x5TO3TyLdMPFm7mT28ijWoHZBPU5W6ty | 29-615-917-5641 | ideas maintain carefully. carefully bold din |
      | 9822.22 | Supplier#000003440 | UNITED KINGDOM | 1978420 | Manufacturer#2 | 93S5pntmWhw R6U4ZD ROQ,2gI17b3 | 33-495-208-7899 | ake carefully after the fluffily re |
      | 9818.98 | Supplier#000060094 | GERMANY | 1110071 | Manufacturer#4 | P8CrJmDT2lihE | 17-293-298-6268 | nt ideas along the quickly express theodolites doze slyly quickly careful pinto |
      | 9814.50 | Supplier#000019945 | ROMANIA | 894936 | Manufacturer#1 | Y6YcWcdK31rTOxGAYA,oZKgaoyzBPgQ | 29-732-301-5529 | blithely fluffy packages. sl |
      | 9813.27 | Supplier#000055123 | ROMANIA | 1480080 | Manufacturer#1 | bDiIx yNRXcigioRWmNxDwV Kp3b172yzY4 | 29-736-401-5608 | boost quickly above the enticing, final asymptotes. carefully |
      | 9809.56 | Supplier#000078281 | FRANCE | 778280 | Manufacturer#4 | a5zMC6gsO4eu40xEGompp9EG5Bcv2 | 16-497-471-5554 | ar deposits snooze quickly furiou |
      | 9808.25 | Supplier#000012649 | ROMANIA | 1162626 | Manufacturer#1 | MdUWGpibJY uamEuhvpWzgyzyDn Uxl8QYkdCqbU | 29-622-551-4334 | he regular pinto beans are fluffily since the u |
      | 9807.53 | Supplier#000000437 | GERMANY | 1000436 | Manufacturer#1 | HuqIk0sK4yC6x5be,cTlPrFqqBCHYf | 17-652-134-3031 | usly bold deposits about the pending |
      | 9801.15 | Supplier#000089681 | RUSSIA | 1339654 | Manufacturer#5 | xBuy1Gwgi5s0LIYoP2qU7Y7qBu1ZumPkLMufsB | 32-947-140-8833 | ly! quickly express theodolites nag slyly |
      | 9799.89 | Supplier#000059082 | GERMANY | 1934062 | Manufacturer#2 | tr cwsr N4ip | 17-243-631-5701 | quickly express foxes across the bold, regular instructions wake carefully after the slyly spec |
      | 9793.99 | Supplier#000020982 | ROMANIA | 170979 | Manufacturer#4 | sJZSIUlkU7lQXctqmnWO5IXLF | 29-164-384-7339 | ts are along the furiously regular deposits. reg |
      | 9793.99 | Supplier#000020982 | ROMANIA | 1095971 | Manufacturer#4 | sJZSIUlkU7lQXctqmnWO5IXLF | 29-164-384-7339 | ts are along the furiously regular deposits. reg |
      | 9789.61 | Supplier#000034881 | GERMANY | 284876 | Manufacturer#4 | Vc3Dnx0Mwm05YAR | 17-237-600-1480 | ependencies above the regular packages nag blithel |
      | 9788.73 | Supplier#000083261 | FRANCE | 1258248 | Manufacturer#4 | 1eof4IF4xyXiEgrc,FcLV7SHf | 16-653-115-5484 | to beans. quickly even dolphins are. requests sl |
      | 9784.65 | Supplier#000099527 | FRANCE | 624508 | Manufacturer#4 | 6 RcgjZXcv0E8w2yY | 16-658-692-3768 | cajole carefully grouches-- sometimes ironic accounts use among the blithely ironic packages. f |
      | 9777.85 | Supplier#000044409 | GERMANY | 1419394 | Manufacturer#5 | ihO3vpaZcvYCpo71g9Mo8BbPh8w | 17-739-859-5666 | ress accounts nag against the fluffily unusual requests. bold |
      | 9777.75 | Supplier#000030124 | RUSSIA | 355114 | Manufacturer#4 | vQT4tgo EJSFpgBqp35tVK1,p3n8 Rv | 32-554-818-8924 | ounts sleep slyly above the regular dolphins! regular excuses sleep daringly |
      | 9777.60 | Supplier#000039017 | UNITED KINGDOM | 164013 | Manufacturer#1 | JXisDqw4Put4nbXRjinbDql9gVo,m3ECxwaXeI | 33-324-389-9325 | uriously final asymptotes believe furiously |
      | 9777.60 | Supplier#000039017 | UNITED KINGDOM | 1188994 | Manufacturer#3 | JXisDqw4Put4nbXRjinbDql9gVo,m3ECxwaXeI | 33-324-389-9325 | uriously final asymptotes believe furiously |
      | 9777.37 | Supplier#000071253 | GERMANY | 1496210 | Manufacturer#1 | YXp8hJjinRZ | 17-239-283-7205 | ven pinto beans. bold accounts sleep fur |
      | 9771.20 | Supplier#000065102 | UNITED KINGDOM | 1690053 | Manufacturer#2 | 8b5sN46HiHIoEUvAflzruKFvrp | 33-225-255-3440 | ally around the slyly ironic packages. furiously |
      | 9769.57 | Supplier#000043082 | UNITED KINGDOM | 1568036 | Manufacturer#3 | Me4vwdA0gZmQE8uDrP | 33-958-753-9986 | even deposits are fluffily after the slyly special theodolites. slyly ironic accounts hag |
      | 9767.32 | Supplier#000073781 | FRANCE | 1823744 | Manufacturer#4 | LWLjymYpnPf1VxJkBpbausoKS2RpXWVZWBOD | 16-282-344-5601 | nstructions haggle after the express, express courts. fluffily ironic foxes according t |
      | 9766.22 | Supplier#000066352 | GERMANY | 1516321 | Manufacturer#3 | ZcFNrwzNDkzf7PzdO0 | 17-427-880-3444 | e of the regular foxes. ironic d |
      +-----------+--------------------+----------------+-----------+----------------+------------------------------------------+-----------------+------------------------------------------------------------------------------------------------------+
      100 rows in set (6.52 sec)

      Q2问题分析:

      SQL拆分分布执行测试

      内部子查询:

      mysql>                             select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region,
      -> part
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE';

      +--------------------+
      | min(ps_supplycost) |
      +--------------------+
      | 1.00 |
      +--------------------+
      1 row in set (25.07 sec)

      用const量替换子查询结果

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = 1
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;
      Empty set (0.25 sec)

      去除p_partkey = ps_partkey条件

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = 1
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;

      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | 9822.85 | Supplier#000097100 | FRANCE | 249 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 323 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1015 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1634 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2037 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2156 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3080 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3563 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3822 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3873 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      10 rows in set (1.21 sec)

      去除p_partkey = ps_partkey条件且使用子查询

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = (
      -> select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region,
      -> part
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> )
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;

      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | 9822.85 | Supplier#000097100 | FRANCE | 249 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 323 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1015 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1634 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2037 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2156 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3080 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3563 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3822 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3873 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      10 rows in set (25.85 sec)

      仅使用条件p_partkey = ps_partkey

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> p_partkey = ps_partkey
      -> limit 10;
      +-----------+--------------------+-----------+-----------+----------------+-------------------------------------+-----------------+------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+-----------+-----------+----------------+-------------------------------------+-----------------+------------------------------+
      | 5755.94 | Supplier#000000001 | ALGERIA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | ARGENTINA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | BRAZIL | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | CANADA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | EGYPT | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | ETHIOPIA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | FRANCE | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | GERMANY | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | INDIA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      | 5755.94 | Supplier#000000001 | INDONESIA | 1 | Manufacturer#1 | N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ | 27-918-335-1736 | each slyly above the careful |
      +-----------+--------------------+-----------+-----------+----------------+-------------------------------------+-----------------+------------------------------+
      10 rows in set (4.21 sec)

      仅去除ps_supplycost = 1的条件

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;
      +-----------+--------------------+---------+-----------+----------------+-----------------------------------+-----------------+------------------------------------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+---------+-----------+----------------+-----------------------------------+-----------------+------------------------------------------------------------------------------------------+
      | 9994.37 | Supplier#000030084 | GERMANY | 380077 | Manufacturer#5 | gBEvSkyW o1uHea0CV,oHtkTTVW | 17-519-171-6883 | pinto beans sleep fluffily alongside of the slyly special deposits. slyly pendi |
      | 9992.54 | Supplier#000099650 | RUSSIA | 824625 | Manufacturer#3 | ySI FMlh9gHkEDN6gQWf3 | 32-971-481-2533 | ged deposits cajole carefully packages. carefully final ideas affix furiously. regu |
      | 9987.51 | Supplier#000020657 | ROMANIA | 395653 | Manufacturer#5 | 4pL,8BT3Yun,17QHqAr9 A,ZFyyuH4L | 29-167-460-7830 | otes. excuses behind the blithely regular packages are furio |
      | 9986.40 | Supplier#000082995 | RUSSIA | 1782994 | Manufacturer#5 | CXiBNZ6DUBjgY | 32-510-919-3096 | nding instructions boost. unusual, regular asymptotes above the fluffily express e |
      | 9984.69 | Supplier#000008875 | ROMANIA | 633856 | Manufacturer#4 | hRdOqKqyU,sHq | 29-132-904-4395 | ong the bold pinto beans are furiously blithely slow |
      | 9984.30 | Supplier#000081977 | RUSSIA | 1356963 | Manufacturer#5 | gemeY46TI2J6ZAt9gjouxB | 32-569-570-6149 | ng to the furiously special package |
      | 9983.76 | Supplier#000024757 | RUSSIA | 599751 | Manufacturer#4 | vJb,kFRqwsv34H5Y6GsRAEJXz0VCZ | 32-868-781-9721 | nal foxes. theodolites cajole regular, final grouches. unusual, final theodolites lose |
      | 9980.25 | Supplier#000067392 | RUSSIA | 192388 | Manufacturer#2 | oEQvrLi316,0I7Z | 32-872-236-1034 | nal pinto beans cajole quickly. final excuses about the deposits |
      | 9974.93 | Supplier#000072260 | ROMANIA | 397250 | Manufacturer#3 | ijrpECIzgkK,qi83qjKtf0qhMX4O3i17i | 29-745-482-4154 | its above the special deposits engage slyly among the unusual, even asymptotes. carefull |
      | 9974.93 | Supplier#000072260 | ROMANIA | 1847241 | Manufacturer#1 | ijrpECIzgkK,qi83qjKtf0qhMX4O3i17i | 29-745-482-4154 | its above the special deposits engage slyly among the unusual, even asymptotes. carefull |
      +-----------+--------------------+---------+-----------+----------------+-----------------------------------+-----------------+------------------------------------------------------------------------------------------+
      10 rows in set (8.45 sec)

      去除子查询的s_suppkey = ps_suppkey条件

      mysql>                         select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = (
      -> select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> )
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | 9822.85 | Supplier#000097100 | FRANCE | 249 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 323 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1015 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1634 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2037 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2156 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3080 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3563 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3822 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3873 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      10 rows in set (8.65 sec)

      子查询中存在条件p_partkey = ps_partkey时

      mysql>                             select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region,
      -> part
      -> where
      -> p_partkey = ps_partkey
      -> and s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE';

      +--------------------+
      | min(ps_supplycost) |
      +--------------------+
      | 1.00 |
      +--------------------+
      1 row in set (21.92 sec)

      子查询中没有条件p_partkey = ps_partkey时

      mysql>                             select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region,
      -> part
      -> where
      -> s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE';

      +--------------------+
      | min(ps_supplycost) |
      +--------------------+
      | 1.00 |
      +--------------------+
      1 row in set (8.00 sec)

      测试结果:

      外部与子查询中的p_partkey = ps_partkey条件,任何一个存在,都导致查询结果为空

      mysql>                        select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_supplycost = (
      -> select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> )
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey
      -> limit 10;
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | s_acctbal | s_name | n_name | p_partkey | p_mfgr | s_address | s_phone | s_comment |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      | 9822.85 | Supplier#000097100 | FRANCE | 249 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 323 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1015 | Manufacturer#4 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 1634 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2037 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 2156 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3080 | Manufacturer#2 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3563 | Manufacturer#1 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3822 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      | 9822.85 | Supplier#000097100 | FRANCE | 3873 | Manufacturer#5 | tb1gKkaBAniS | 16-489-642-7398 | sly final platelets cajole. furiously even deposits use daringl |
      +-----------+--------------------+--------+-----------+----------------+--------------+-----------------+-----------------------------------------------------------------+
      10 rows in set (9.18 sec)

      partsupp表中的ps_suppkey列缺失对等的数据

      *************************** 100. row ***************************
      s_acctbal: 9766.22
      s_name: Supplier#000066352
      n_name: GERMANY
      p_partkey: 1516321
      p_mfgr: Manufacturer#3
      s_address: ZcFNrwzNDkzf7PzdO0
      s_phone: 17-427-880-3444
      s_comment: e of the regular foxes. ironic d
      p_partkey: 1516321
      ps_partkey: 1516321
      100 rows in set (1.13 sec)
      *************************** 23. row ***************************
      s_acctbal: -686.61
      s_name: Supplier#000012210
      n_name: RUSSIA
      p_partkey: 1516321
      p_mfgr: Manufacturer#3
      s_address: jW0N5R,fhhKq309PWv1ItFhE Iyt
      s_phone: 32-345-565-3726
      s_comment: pliers are slyly final epitaphs. furiously regular requests sleep furiously always regular a
      ps_supplycost: 1.00
      p_partkey: 1516321
      ps_suppkey: 12210
      23 rows in set (8.15 sec)
      mysql>                        select
      -> s_acctbal,
      -> s_name,
      -> n_name,
      -> p_partkey,
      -> p_mfgr,
      -> s_address,
      -> s_phone,
      -> s_comment,
      -> ps_supplycost,
      -> p_partkey,
      -> ps_suppkey
      -> from
      -> part,
      -> supplier,
      -> partsupp,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and p_size = 15
      -> and p_type like '%BRASS'
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> and ps_partkey = 1516321
      -> and ps_supplycost = (
      -> select
      -> min(ps_supplycost)
      -> from
      -> partsupp,
      -> supplier,
      -> nation,
      -> region
      -> where
      -> s_suppkey = ps_suppkey
      -> and s_nationkey = n_nationkey
      -> and n_regionkey = r_regionkey
      -> and r_name = 'EUROPE'
      -> )
      -> order by
      -> s_acctbal desc,
      -> n_name,
      -> s_name,
      -> p_partkey\G
      Empty set (7.97 sec)
      版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/adofsauron/5668072,作者:帝尊悟世,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。

      上一篇:mysql/stonedb-IN操作符查询优化-进度记录

      下一篇:安装MySQL的常见问题

      相关文章

      2025-05-13 09:49:27

      mysql一些小知识点

      mysql 使用的是三值逻辑:TRUE FALSE UNKNOWN。

      2025-05-13 09:49:27
      left , mod , mysql , null , select , user
      2025-05-08 09:04:49

      MySQL-备份+日志:介质故障与数据库恢复

      MySQL-备份+日志:介质故障与数据库恢复

      2025-05-08 09:04:49
      mysql , MySQL , 备份 , 恢复 , 数据库 , 文件 , 日志
      2025-05-08 09:03:29

      windows下mybatis插入mysql数据中文乱码问题解决

      windows下mybatis插入mysql数据中文乱码问题解决

      2025-05-08 09:03:29
      amp , ini , jdbc , mysql , 乱码
      2025-05-07 09:09:52

      基础—SQL—DCL(数据控制语言)之用户管理

      基础—SQL—DCL(数据控制语言)之用户管理

      2025-05-07 09:09:52
      mysql , 创建 , 数据库 , 权限 , 用户 , 访问
      2025-05-07 09:09:52

      基础—SQL—DCL(数据控制语言)小结

      基础—SQL—DCL(数据控制语言)小结

      2025-05-07 09:09:52
      mysql , SQL , 数据库 , 权限 , 用户 , 管理 , 语句
      2025-05-07 09:08:08

      基于servlet+jsp+mysql实现的java web校园车辆管理系统

      本项目是一套基于servlet+jsp+mysql实现的java web校园车辆管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。

      2025-05-07 09:08:08
      mysql , 信息 , 信息管理 , 添加 , 源码
      2025-05-07 09:07:56

      基于JavaFX和mysql实现的驾考习题管理系统

      本项目是一套基于JavaFX和mysql实现的驾考习题管理系统,主要针对计算机相关专业的正在做bishe的学生和需要项目实战练习的Java学习者。

      2025-05-07 09:07:56
      mysql , 数据库 , 项目
      2025-04-11 07:15:54

      java使用JDBC方式操作mysql数据库示例

      java使用JDBC方式操作mysql数据库示例

      2025-04-11 07:15:54
      java , JDBC , mysql , 数据库 , 示例
      2025-04-09 09:17:07

      mysql Commands out of sync; you can‘t run this command now

      mysql Commands out of sync; you can‘t run this command now

      2025-04-09 09:17:07
      mysql , query , 执行
      2025-03-31 08:57:16

      PDO ping 的实例 ,解决mysql has gone的问题

      PDO ping 的实例 ,解决mysql has gone的问题

      2025-03-31 08:57:16
      mysql
      查看更多
      推荐标签

      作者介绍

      天翼云小翼
      天翼云用户

      文章

      33561

      阅读量

      5240491

      查看更多

      最新文章

      mysql一些小知识点

      2025-05-13 09:49:27

      windows下mybatis插入mysql数据中文乱码问题解决

      2025-05-08 09:03:29

      java使用JDBC方式操作mysql数据库示例

      2025-04-11 07:15:54

      mysql Commands out of sync; you can‘t run this command now

      2025-04-09 09:17:07

      PDO ping 的实例 ,解决mysql has gone的问题

      2025-03-31 08:57:16

      navicat导入excel文件的步骤以及可能碰到的问题

      2025-03-26 09:08:50

      查看更多

      热门文章

      Windows下使用批处理实现启动关闭mysql

      2023-04-24 11:27:05

      cdh安装到scm-server的mysql报错处理

      2023-04-28 02:38:44

      Nacos数据持久化到MySQL

      2023-05-12 07:20:56

      python学习——使用MySQL

      2023-04-27 07:57:16

      MySQL的间隙锁

      2023-05-12 07:20:56

      正确理解Mysql的列索引和多列索引

      2023-05-12 07:20:42

      查看更多

      热门标签

      数据库 mysql 字符串 数据结构 MySQL 算法 redis oracle java sql python 数据 索引 SQL 查询
      查看更多

      相关产品

      弹性云主机

      随时自助获取、弹性伸缩的云服务器资源

      天翼云电脑(公众版)

      便捷、安全、高效的云电脑服务

      对象存储

      高品质、低成本的云上存储服务

      云硬盘

      为云上计算资源提供持久性块存储

      查看更多

      随机文章

      MySQL 基础教程[9]

      pandas的read_sql查询mysql有汉字时有?乱码

      如果mysql磁盘满了,会发生什么?还真被我遇到了!

      Try setting a different JdbcType for this parameter or a different configuration property错误的详细解决方法

      MySQL问题解决集锦

      【mysql】字符串函数

      • 7*24小时售后
      • 无忧退款
      • 免费备案
      • 专家服务
      售前咨询热线
      400-810-9889转1
      关注天翼云
      • 旗舰店
      • 天翼云APP
      • 天翼云微信公众号
      服务与支持
      • 备案中心
      • 售前咨询
      • 智能客服
      • 自助服务
      • 工单管理
      • 客户公告
      • 涉诈举报
      账户管理
      • 管理中心
      • 订单管理
      • 余额管理
      • 发票管理
      • 充值汇款
      • 续费管理
      快速入口
      • 天翼云旗舰店
      • 文档中心
      • 最新活动
      • 免费试用
      • 信任中心
      • 天翼云学堂
      云网生态
      • 甄选商城
      • 渠道合作
      • 云市场合作
      了解天翼云
      • 关于天翼云
      • 天翼云APP
      • 服务案例
      • 新闻资讯
      • 联系我们
      热门产品
      • 云电脑
      • 弹性云主机
      • 云电脑政企版
      • 天翼云手机
      • 云数据库
      • 对象存储
      • 云硬盘
      • Web应用防火墙
      • 服务器安全卫士
      • CDN加速
      热门推荐
      • 云服务备份
      • 边缘安全加速平台
      • 全站加速
      • 安全加速
      • 云服务器
      • 云主机
      • 智能边缘云
      • 应用编排服务
      • 微服务引擎
      • 共享流量包
      更多推荐
      • web应用防火墙
      • 密钥管理
      • 等保咨询
      • 安全专区
      • 应用运维管理
      • 云日志服务
      • 文档数据库服务
      • 云搜索服务
      • 数据湖探索
      • 数据仓库服务
      友情链接
      • 中国电信集团
      • 189邮箱
      • 天翼企业云盘
      • 天翼云盘
      ©2025 天翼云科技有限公司版权所有 增值电信业务经营许可证A2.B1.B2-20090001
      公司地址:北京市东城区青龙胡同甲1号、3号2幢2层205-32室
      • 用户协议
      • 隐私政策
      • 个人信息保护
      • 法律声明
      备案 京公网安备11010802043424号 京ICP备 2021034386号