? 在Oracle performance tuning guide中,对执行计划顺序的描述是最右最上最先执行,然后父步骤执行,也就是最右边的步骤最先执行,如果同等级,那么最上边的最先执行,然后执行其父步骤(文档原文:The execution order in EXPLAIN PLAN output begins with
? 在Oracle performance tuning guide中,对执行计划顺序的描述是最右最上最先执行,然后父步骤执行,也就是最右边的步骤最先执行,如果同等级,那么最上边的最先执行,然后执行其父步骤(文档原文:The execution order in EXPLAIN PLAN output begins with the line that is the?furthest indented to the right. The next step is the parent of that line. If two lines?are indented equally, then the top line is normally executed first)。
? ? ? 在实际应用中,这个规则不是完全正确的。ORACLE的SQL内部步骤的执行顺序与其计划中的展现,会有一定的差别,如果不仔细分析,而且一味相信文档,那么可能会感觉很迷惑。比如在标量子查询中(scalary subquery),执行计划的显示会非常让人困惑,如:
? ? ? ? ID NAME ———- ———————————- ? ? ? ? ?1 a ? ? ? ? ?2 b ? ? ? ? ?3 c 3 rows selected. SQL> select * from b; ? ? ? ? ID NAME ———- ———————————- ? ? ? ? ?1 x1 ? ? ? ? ?2 x2 2 rows selected. SQL> SELECT a.ID,a.NAME,(SELECT b.ID FROM b WHERE a.ID=b.ID)?bid FROM a; 执行计划 ———————————————————- Plan hash value: 2657529235 ————————————————————————– | Id ?| Operation ? ? ? ? | Name | Rows ?| Bytes | Cost (%CPU)| Time ? ? | ————————————————————————– | ? 0 | SELECT STATEMENT ?| ? ? ?| ? ? 3 | ? ?60 | ? ? 3 ? (0)| 00:00:01 | |* ?1 | ?TABLE ACCESS FULL| B ? ?| ? ? 1 | ? ?13 | ? ? 3 ? (0)| 00:00:01 | | ? 2 | ?TABLE ACCESS FULL| A ? ?| ? ? 3 | ? ?60 | ? ? 3 ? (0)| 00:00:01 | ————————————————————————– Predicate Information (identified by operation id): ————————————————— ? ?1 – filter(“B”.”ID”=:B1) |
? ? ??如果按照文档的的分析,显然ID=2的与ID=1的是同等级的,ID=1的在ID=2的上面,那么最后执行计划的顺序应该是1—->2—–>0,但是分析下,显然不是这样的顺序,肯定是必须获得a.id之后,才能用a.id去查找B。通过谓词中的”B”.”ID”=:B1可以看出来,:B1,类似于绑定变量,这里就2张表,而且根据SQL查询,肯定来源于A.ID。所以对于标量子查询的计划,应该是2—->1—–>0,而且2与1的操作是类似于NESTED LOOPS(与其不同的是,标量子查询的驱动表是inner table)的操作,每1个A的行,都会执行一次B,当然,ORACLE内部肯定是有优化的,这种优化就是会缓存已经匹配的A.ID值,遇到相同的,不会重复扫描B。可以通过DBMS_XPLAN.DISPLAY_CURSOR详细看看如何执行的:
SQL_ID ?caq6tcx266xnq, child number 1 ————————————- SELECT a.ID,a.NAME,(SELECT b.ID FROM b WHERE a.ID=b.ID) bid FROM a Plan hash value: 2657529235 ———————————————————————————— | Id ?| Operation ? ? ? ? | Name | Starts | E-Rows | A-Rows | ? A-Time ? | Buffers | ———————————————————————————— | ? 0 | SELECT STATEMENT ?| ? ? ?| ? ? ?1 | ? ? ? ?| ? ? ?3 |00:00:00.01 | ? ? ? 8 | |* ?1 | ?TABLE ACCESS FULL| B ? ?| ? ???3?| ? ? ?1 | ? ? ?2 |00:00:00.01 | ? ? ?21 | | ? 2 | ?TABLE ACCESS FULL| A ? ?| ? ? ?1 | ? ? ?3 | ? ???3?|00:00:00.01 | ? ? ? 8 | ———————————————————————————— Predicate Information (identified by operation id): ————————————————— ? ?1 – filter(“B”.”ID”=:B1) |
? ? ??其中A共3行,访问B 3次,返回B 2行,因为有一行不匹配,由A的行驱动访问B。因为这里A.ID无重复值,下面插入一行id=1的,因为id=1已经在A表中存在,因此,标量子查询有缓存,所以对B的扫描还是3次,而不是4次,如下:
1 row created. |

mysqlviewshavelimitations:1)他们不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinSorsubqueries.2)他们canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementInmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)复杂的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通过PHP网页界面添加MySQL用户可以使用MySQLi扩展。步骤如下:1.连接MySQL数据库,使用MySQLi扩展。2.创建用户,使用CREATEUSER语句,并使用PASSWORD()函数加密密码。3.防止SQL注入,使用mysqli_real_escape_string()函数处理用户输入。4.为新用户分配权限,使用GRANT语句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingsefectery.1)usecharforfixed lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

SublimeText3汉化版
中文版,非常好用

Dreamweaver CS6
视觉化网页开发工具

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)