下图显示了SQL在Oracle内部处理的一般阶段:解析、优化、产生行源和执行。数据库可能会忽略某些步骤,这取决于具体的语句。
(看来,SQL文本的哈希值是在PGA中产生的)。
如果检查到共享库中有一个语句具有相同的哈希值,则数据库在执行语义和环境检查(工作区大小或优化器设置等),当然还有语句本身的书写(大小写,,空格,注释等)。
详情可参见笔记:《Oracle性能调优之硬解析与软解析》
2,SQL优化
查询优化是选择执行SQL语句的最有效手段的过程。数据库对查询的优化基于对正在访问的实际数据收集的统计信息。优化器使用行数、数据集大小 和 其他因素来生成各种可能的执行计划,并为每个计划分配一个成本值。数据库会使用具有最低成本的计划。
数据库对每个唯一的DML语句必须至少执行一次硬解析,并在硬解析期间执行优化。DDL永远不会被优化,除非他包括需要优化的DML组件,如子查询。
3,SQL行源生成
行源生成器是一种软件,它从优化器接受经过优化的执行计划,并生成一个称为查询计划的迭代计划,一共数据库的其余部分使用。查询计划采用组合多个步骤的形式,每一步返回一个行集。该集合中的行可以在下一步被使用,火灾最后一步返回给发出SQL语句的应用程序。
行源就是执行计划中的某一步多返回的行集,且带有能够迭代该行集的控制结构,行源可以是表、视图、或连接操作或分组操作的结果。
行源生成器产生一个行源树,它是一个行源的集合。(就是我们看到的执行计划)
4,SQL执行
在执行期间,SQL引擎执行行源生成器所产生的数中的每个行源。这一步是在DML处理中唯一的强制性步骤。在执行计划中,我们经常看到就是的一个执行树,显示了行源从一部流向另一步。通常,执行步骤的顺序与几乎是顺序相反,所以我们应该从底向上来阅读计划。在operation列中的初始空格表示层次结构关系。例如,如果一个操作的名称前面有两个空格,则此操作是前面有一个空格的操作的子操作。前面有一个空格的操作是select语句本身的子操作。
参考:#CNCPT216

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
