Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us

Processing select statement in oracle database

 Atikh Shaikh     architecture, oracle     No comments   

Understanding the execution of any query in the Oracle database needs an understanding of different components of the Oracle database such as SGA, Processes, datafiles, memory, etc.

Here, we will discuss the execution of a simple select query like “select * from

 hr.emp

select query processing in oracle database


First of all, a connection to the database is required, and to achieve that you need to know database connection details such as port number, hostname, sid, etc. Once you have these details, the user will log in to the database and a connection is established using the listener.

Now user can execute any query, the query sent by the user once reaches the database, gets picked up by the server process, and from here onwards, processing will be carried out by the server process.

The server process will create a hash for the SQL query sent by the user, the hash is just hexadecimal coding in the form of SQL id and SQL hash value.

Now server process searches in the shared pool and checks if any SQL area is present for the user query, if SQL area is already present for this query, if the result finds in SQL area, data will be returned to the user from memory itself, no further process required.

In case the SQL area is not present for this SQL query, that means the query is getting executed the first time in the database. The server process will start building SQL area for the query

Processing of the select query is taken in 3 main parts

  • Parsing
  • Execution
  • Fetching

Parsing

Parsing is also known as validation of the query sent by the user, it will be done in three steps

  • Syntax check
  • Semantics check
  • Privilege check

Syntax Check

            Here, the syntax of the SQL query will be verified as per SQL standards and keywords, sometimes we misspell some keywords such as “SELECT” is written as “SLECT” or “SELCT”, syntax check will throw an error, once the syntax check is passed, it moves to semantic check

Semantic check

            In semantic check, the server process verifies the structure of the query, i.e., columns names, tables, or schema names used will be verified with the help of a dictionary cache

Privilege check

In this stage of parsing, privileges on users will be verified, the client is executing the query using USER1 schema and accessing the table from USER2, so the server process will check if USER1  has access to USER2

Once all these checks are verified as part of the parsing, it will start the execution of the SQL query based on the SQL plan described by OPTIMIZER, OPTIMIZER is an internal utility in the database, that keeps all the statistics of the database objects

The server process will bring data in the buffer cache i.e., memory from datafiles, once data is loaded in the memory, a complete SQL area will be created and the server process will return data to the user, this completes the processing of the SQL query. so, processing the query involves a lot of components of the database

  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (74)

Blog Archive

  • ►  2018 (38)
    • ►  November (25)
    • ►  December (13)
  • ►  2019 (33)
    • ►  January (15)
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ►  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ►  July (3)
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ▼  2023 (14)
    • ►  February (1)
    • ▼  April (5)
      • Processing select statement in oracle database
      • Oracle Database 23c Features
      • Install Oracle Virtual box(VM Box) on windows system
      • Oracle 23c : Download and Install on Windows 10
      • Want to Convert number to text/word form? Here is ...
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ►  2025 (6)
    • ►  March (1)
    • ►  April (3)
    • ►  May (2)

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • Oracle 23ai : Use of NOVALIDATE Constraints in IMPDP
    While performing impdp operations in the Oracle database, Oracle performs validation checks for every constraint on the imported table, that...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © Atikh's DBA blog | Powered by Blogger