Introduction to embedded sql for NonStop SQLFrans Jongma
This document provides an introduction to using embedded SQL for NonStop SQL/MX. It discusses the compilation process which involves preprocessing SQL statements, compiling the host language code, and compiling the SQL to generate an execution plan stored in a module file. It provides examples of simple compilation and controlling the module names and locations. The goal is to help new SQL/MX users get started quickly with embedded SQL.
This document discusses the Module File Cache (MFC) feature of NonStop SQL/MX, which provides a persistent cache for SQL statements beyond what is possible with the internal SQL/MX query cache. MFC caches compiled SQL statements on disk for reuse across connections and application instances. It works with the JDBC and ODBC drivers to improve performance by avoiding recompilation of statements that have already been compiled and cached in MFC modules on disk. The document covers how MFC is organized, best practices for its use, and some current limitations.
Concepts of NonStop SQL/MX: Part 3 - Introduction to MetadataFrans Jongma
Series of articles written for DBA’s and developers who know Oracle and want to learn about NonStop SQL/MX. Useful for people who know NonStop, and would like to know about similarities and differences between the two products.
Understanding NonStop SQLMX SDA and its impact on performanceFrans Jongma
This paper describes how the Session Data Area (SDA) is used and how its configuration affects performance. The
area is reserved on a session basis and query fragments of a session can only be reused by the same session. It differs in this from the database data cache in DP2, which is shared by all
clients. Because the area is a shared resource and the amount of data is limited, it is advised to track its usage and where possible, adjust the size of the area to the amount of sessions.
Many customers of NonStop SQL/MP are using the SQL/MX engine to access the data that is stored in SQL/MP tables. They enjoy the features of ANSI DML and use the JDBC drivers in Java programs and ODBC drivers for off-platform applications written in other languages.
This document summarizes the advantages of using the NonStop SQL/MX native tables. It is intended for architects, designers, developers of applications written for or being ported to NonStop Servers as well as database administrators (DBAs) that manage SQL/MP or SQL/MX databases.
Introduction to embedded sql for NonStop SQLFrans Jongma
This document provides an introduction to using embedded SQL for NonStop SQL/MX. It discusses the compilation process which involves preprocessing SQL statements, compiling the host language code, and compiling the SQL to generate an execution plan stored in a module file. It provides examples of simple compilation and controlling the module names and locations. The goal is to help new SQL/MX users get started quickly with embedded SQL.
This document discusses the Module File Cache (MFC) feature of NonStop SQL/MX, which provides a persistent cache for SQL statements beyond what is possible with the internal SQL/MX query cache. MFC caches compiled SQL statements on disk for reuse across connections and application instances. It works with the JDBC and ODBC drivers to improve performance by avoiding recompilation of statements that have already been compiled and cached in MFC modules on disk. The document covers how MFC is organized, best practices for its use, and some current limitations.
Concepts of NonStop SQL/MX: Part 3 - Introduction to MetadataFrans Jongma
Series of articles written for DBA’s and developers who know Oracle and want to learn about NonStop SQL/MX. Useful for people who know NonStop, and would like to know about similarities and differences between the two products.
Understanding NonStop SQLMX SDA and its impact on performanceFrans Jongma
This paper describes how the Session Data Area (SDA) is used and how its configuration affects performance. The
area is reserved on a session basis and query fragments of a session can only be reused by the same session. It differs in this from the database data cache in DP2, which is shared by all
clients. Because the area is a shared resource and the amount of data is limited, it is advised to track its usage and where possible, adjust the size of the area to the amount of sessions.
Many customers of NonStop SQL/MP are using the SQL/MX engine to access the data that is stored in SQL/MP tables. They enjoy the features of ANSI DML and use the JDBC drivers in Java programs and ODBC drivers for off-platform applications written in other languages.
This document summarizes the advantages of using the NonStop SQL/MX native tables. It is intended for architects, designers, developers of applications written for or being ported to NonStop Servers as well as database administrators (DBAs) that manage SQL/MP or SQL/MX databases.
Many customers of NonStop SQL/MP are using the SQL/MX engine to access the data that is stored in SQL/MP tables. They enjoy the features of ANSI DML and use the JDBC drivers in Java programs and ODBC drivers for off-platform applications written in other languages.
This document summarizes the advantages of using the NonStop SQL/MX native tables. It is intended for architects, designers, developers of applications written for or being ported to NonStop Servers as well as database administrators (DBAs) that manage SQL/MP or SQL/MX databases.
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objectsFrans Jongma
Series of articles written for DBA’s and developers who know Oracle and want to learn about NonStop SQL/MX. Useful for people who know NonStop, and would like to know about similarities and differences between the two products.
The eBITUG 2017 presentation that provides and overview of DBaaS capabilities delivered by NonStop SQL/MX. It also shows how DBS simplifies provision of databases and facilitates automation. It supports virtualized as well as regular NonStop X86-based systems.
The document discusses PL/SQL security and transactions in Oracle. It defines single and multiple query transactions and explains how Oracle implements concurrency control through locking at the row, page and table levels using shared and exclusive locks. It also discusses implicit locking as Oracle's default strategy and how explicit locking can override this. The document provides examples of using SELECT...FOR UPDATE and LOCK TABLE statements for explicit locking.
NonStop SQL/MX DBS demo with iTP WebserverFrans Jongma
This is a step-by-step overview of NonStop SQL/MX Database Services can be used to quickly provision a database and some additional functions. The demo was created using a few very simple HTML pages that invoke the DBS interface.
The document describes several Oracle Clusterware commands used to manage application profiles and register, relocate, start, and stop applications in an Oracle Clusterware environment. Some key commands covered include crs_profile for creating and managing application profiles, crs_register for registering applications with Oracle Clusterware, and crs_relocate for moving registered applications between nodes. The document provides syntax, examples, and descriptions for using these commands.
Watch Re-runs on your SQL Server with RML Utilitiesdpcobb
RML Utilities provide command line tools and interactive reports enabling you to:
Take SQL trace files (captured with SQL Profiler, sp_trace or extended events in SQL 2012+),
Process them into replayable RML files (using readtrace.exe),
Play them back in a different SQL environment (using ostress.exe),
And compare the performance at a granular level (using reporter.exe or custom queries).
The document discusses embedded SQL statements and stored procedures in Oracle databases. Embedded SQL allows SQL statements to be placed within a host programming language like C/C++. Stored procedures are named PL/SQL blocks that perform specific database-related tasks. Triggers are PL/SQL blocks that automatically execute in response to data changes, such as inserts or updates.
PL/SQL is a programming language that combines the SQL operations of querying and manipulating data in an Oracle database with the procedural language constructs of variables, conditions, and loops. PL/SQL can be used for database-side programming as well as client-side application development. It provides advantages like better performance, portability, higher productivity, and integration with Oracle. PL/SQL supports various data types, control structures, exception handling, and object-oriented programming features. Cursors allow processing of multiple rows returned from a SQL statement and can be static, dynamic, or reference types. Procedures and functions are reusable program units that allow passing parameters and returning values.
This document discusses RMAN backup and recovery configurations for Real Application Clusters (RAC) databases in three scenarios:
1. Using a cluster file system for backups, where each node backs up to a shared storage location. Recovery can be performed from any node with access to the backups.
2. Using local non-clustered file systems for backups, where each node backs up locally but nodes can access each other's backups over NFS. Recovery requires NFS access to read archived logs from all nodes.
3. Performing instance recovery in RAC, where the surviving instance(s) perform recovery for failed instances using online redo logs to commit pending transactions and roll back uncommitted ones.
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document contains a summary of an Oracle DBA presentation on DBA commands and concepts that every developer should know. The presentation covered topics such as parallel queries, row chaining, explain plans, flashback queries, pending statistics, bulk processing, virtual private databases, extended data types, identity columns, and online table redefinition. It provided examples and demonstrations of many of these commands and concepts.
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
The document provides an overview of DBA commands and concepts that every developer should know. It includes sections on availability of Oracle Database 12c, parallel queries, row chaining and migration, explain plans, Oracle Flashback Query and Table, schema management, rollbacks, pending statistics, bulk processing vs row-by-row, Virtual Private Database, extended data types, SQL text expansion, identity columns, and virtual columns. The presentation aims to help developers better understand database administration tasks and functionality.
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
Oracle Database 12c includes many new tuning features for developers and DBAs. Some key features include:
- Multitenant architecture allows multiple pluggable databases to consolidate workloads on a single database instance for improved utilization and administration.
- In-memory column store enables real-time analytics on frequently accessed data held entirely in memory for faster performance.
- New SQL syntax like FETCH FIRST for row limiting and offsetting provides more readable and intuitive replacements for previous techniques.
- Adaptive query optimization allows queries to utilize different execution plans like switching between nested loops and hash joins based on runtime statistics for improved performance.
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
There are several tools available for SQL tuning in Oracle, including those that generate explain plans, analyze trace files, and provide real-time SQL monitoring. The document discusses tuning methodology, generating explain plans with SQL*Plus and Autotrace, tracing using parameters and DBMS_MONITOR, and tools like DBMS_XPLAN, TRCA, SQLTXPLAIN, Oracle Active Report, and Toad. It provides examples of using many of these tools to analyze SQL performance.
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
This document provides an overview of various tools that can be used for tuning Oracle SQL statements. It discusses tuning methodology, generating explain plans and traces, and tools like SQL*Plus autotrace, DBMS_XPLAN, TRCA trace analyzer, and SQLTXPLAIN. Demo examples are provided for many of the tools to analyze SQL performance.
1. The document describes the prerequisites for setting up output in Excel using PL/SQL with XML, including designing an Excel layout, defining a stored procedure and concurrent program, and setting up required profiles.
2. It provides steps to create a PL/SQL package to generate the XML code for the Excel output, including functions to print the header, data rows, and footer.
3. Running the package main procedure will execute a cursor to fetch data and write it to the XML output, which can then be viewed in Excel when selecting that option.
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015Alex Zaballa
Oracle Database 12c includes over 500 new features designed for cloud computing, big data, security, and availability. Key features include Multitenant architecture which allows multiple databases to share a single database instance, In-Memory which stores frequently accessed data in memory for faster queries, and new security features like data redaction and encryption. Additional features improve performance, manageability, and flexibility of the database like JSON support, heat map statistics, and identity columns.
Performance tuning involves improving the performance of computer systems, typically databases. It involves identifying high load or inefficient SQL statements, verifying execution plans, and implementing corrective actions. Tuning goals include reducing workload through better queries and plans, balancing workload between peak and off-peak times, and parallelizing workload. High load statements can be identified through SQL tracing tools, and TKProf can analyze trace files to identify top SQL and plans.
This document provides guidelines for tuning SQL statements to improve response time. It discusses reviewing table and column statistics, execution plans, and restructuring SQL statements and indexes. Specific techniques covered include gathering statistics, reviewing access paths like index scans and joins, and using SQL profiles to lock optimized plans.
Many customers of NonStop SQL/MP are using the SQL/MX engine to access the data that is stored in SQL/MP tables. They enjoy the features of ANSI DML and use the JDBC drivers in Java programs and ODBC drivers for off-platform applications written in other languages.
This document summarizes the advantages of using the NonStop SQL/MX native tables. It is intended for architects, designers, developers of applications written for or being ported to NonStop Servers as well as database administrators (DBAs) that manage SQL/MP or SQL/MX databases.
Concepts of NonStop SQL/MX: Part 2 - Introduction to catalogs and other objectsFrans Jongma
Series of articles written for DBA’s and developers who know Oracle and want to learn about NonStop SQL/MX. Useful for people who know NonStop, and would like to know about similarities and differences between the two products.
The eBITUG 2017 presentation that provides and overview of DBaaS capabilities delivered by NonStop SQL/MX. It also shows how DBS simplifies provision of databases and facilitates automation. It supports virtualized as well as regular NonStop X86-based systems.
The document discusses PL/SQL security and transactions in Oracle. It defines single and multiple query transactions and explains how Oracle implements concurrency control through locking at the row, page and table levels using shared and exclusive locks. It also discusses implicit locking as Oracle's default strategy and how explicit locking can override this. The document provides examples of using SELECT...FOR UPDATE and LOCK TABLE statements for explicit locking.
NonStop SQL/MX DBS demo with iTP WebserverFrans Jongma
This is a step-by-step overview of NonStop SQL/MX Database Services can be used to quickly provision a database and some additional functions. The demo was created using a few very simple HTML pages that invoke the DBS interface.
The document describes several Oracle Clusterware commands used to manage application profiles and register, relocate, start, and stop applications in an Oracle Clusterware environment. Some key commands covered include crs_profile for creating and managing application profiles, crs_register for registering applications with Oracle Clusterware, and crs_relocate for moving registered applications between nodes. The document provides syntax, examples, and descriptions for using these commands.
Watch Re-runs on your SQL Server with RML Utilitiesdpcobb
RML Utilities provide command line tools and interactive reports enabling you to:
Take SQL trace files (captured with SQL Profiler, sp_trace or extended events in SQL 2012+),
Process them into replayable RML files (using readtrace.exe),
Play them back in a different SQL environment (using ostress.exe),
And compare the performance at a granular level (using reporter.exe or custom queries).
The document discusses embedded SQL statements and stored procedures in Oracle databases. Embedded SQL allows SQL statements to be placed within a host programming language like C/C++. Stored procedures are named PL/SQL blocks that perform specific database-related tasks. Triggers are PL/SQL blocks that automatically execute in response to data changes, such as inserts or updates.
PL/SQL is a programming language that combines the SQL operations of querying and manipulating data in an Oracle database with the procedural language constructs of variables, conditions, and loops. PL/SQL can be used for database-side programming as well as client-side application development. It provides advantages like better performance, portability, higher productivity, and integration with Oracle. PL/SQL supports various data types, control structures, exception handling, and object-oriented programming features. Cursors allow processing of multiple rows returned from a SQL statement and can be static, dynamic, or reference types. Procedures and functions are reusable program units that allow passing parameters and returning values.
This document discusses RMAN backup and recovery configurations for Real Application Clusters (RAC) databases in three scenarios:
1. Using a cluster file system for backups, where each node backs up to a shared storage location. Recovery can be performed from any node with access to the backups.
2. Using local non-clustered file systems for backups, where each node backs up locally but nodes can access each other's backups over NFS. Recovery requires NFS access to read archived logs from all nodes.
3. Performing instance recovery in RAC, where the surviving instance(s) perform recovery for failed instances using online redo logs to commit pending transactions and roll back uncommitted ones.
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document contains a summary of an Oracle DBA presentation on DBA commands and concepts that every developer should know. The presentation covered topics such as parallel queries, row chaining, explain plans, flashback queries, pending statistics, bulk processing, virtual private databases, extended data types, identity columns, and online table redefinition. It provided examples and demonstrations of many of these commands and concepts.
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
The document provides an overview of DBA commands and concepts that every developer should know. It includes sections on availability of Oracle Database 12c, parallel queries, row chaining and migration, explain plans, Oracle Flashback Query and Table, schema management, rollbacks, pending statistics, bulk processing vs row-by-row, Virtual Private Database, extended data types, SQL text expansion, identity columns, and virtual columns. The presentation aims to help developers better understand database administration tasks and functionality.
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
Oracle Database 12c includes many new tuning features for developers and DBAs. Some key features include:
- Multitenant architecture allows multiple pluggable databases to consolidate workloads on a single database instance for improved utilization and administration.
- In-memory column store enables real-time analytics on frequently accessed data held entirely in memory for faster performance.
- New SQL syntax like FETCH FIRST for row limiting and offsetting provides more readable and intuitive replacements for previous techniques.
- Adaptive query optimization allows queries to utilize different execution plans like switching between nested loops and hash joins based on runtime statistics for improved performance.
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
There are several tools available for SQL tuning in Oracle, including those that generate explain plans, analyze trace files, and provide real-time SQL monitoring. The document discusses tuning methodology, generating explain plans with SQL*Plus and Autotrace, tracing using parameters and DBMS_MONITOR, and tools like DBMS_XPLAN, TRCA, SQLTXPLAIN, Oracle Active Report, and Toad. It provides examples of using many of these tools to analyze SQL performance.
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
This document provides an overview of various tools that can be used for tuning Oracle SQL statements. It discusses tuning methodology, generating explain plans and traces, and tools like SQL*Plus autotrace, DBMS_XPLAN, TRCA trace analyzer, and SQLTXPLAIN. Demo examples are provided for many of the tools to analyze SQL performance.
1. The document describes the prerequisites for setting up output in Excel using PL/SQL with XML, including designing an Excel layout, defining a stored procedure and concurrent program, and setting up required profiles.
2. It provides steps to create a PL/SQL package to generate the XML code for the Excel output, including functions to print the header, data rows, and footer.
3. Running the package main procedure will execute a cursor to fetch data and write it to the XML output, which can then be viewed in Excel when selecting that option.
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015Alex Zaballa
Oracle Database 12c includes over 500 new features designed for cloud computing, big data, security, and availability. Key features include Multitenant architecture which allows multiple databases to share a single database instance, In-Memory which stores frequently accessed data in memory for faster queries, and new security features like data redaction and encryption. Additional features improve performance, manageability, and flexibility of the database like JSON support, heat map statistics, and identity columns.
Performance tuning involves improving the performance of computer systems, typically databases. It involves identifying high load or inefficient SQL statements, verifying execution plans, and implementing corrective actions. Tuning goals include reducing workload through better queries and plans, balancing workload between peak and off-peak times, and parallelizing workload. High load statements can be identified through SQL tracing tools, and TKProf can analyze trace files to identify top SQL and plans.
This document provides guidelines for tuning SQL statements to improve response time. It discusses reviewing table and column statistics, execution plans, and restructuring SQL statements and indexes. Specific techniques covered include gathering statistics, reviewing access paths like index scans and joins, and using SQL profiles to lock optimized plans.
This document discusses data manipulation in Oracle databases. It describes how to insert, update, and delete rows from tables using DML statements like INSERT, UPDATE, and DELETE. It also covers transaction management using COMMIT, ROLLBACK, and SAVEPOINT statements to control when changes are committed to the database or rolled back. Key aspects covered include inserting new rows, updating and deleting specific rows or all rows, and handling integrity constraints and transactions.
Oracle 11g new features for developersScott Wesley
Abstract: There are a wealth of new features available in the 11g database release. This presentation touches on SQL & PL/SQL features I found of interest, and concentrates particularly on virtual columns.
Relevant scripts found at my blog
http://grassroots-oracle.com/2009/07/presentations.html#11gNewFeatures
Learning
Base SAS,
Advanced SAS,
Proc SQl,
ODS,
SAS in financial industry,
Clinical trials,
SAS Macros,
SAS BI,
SAS on Unix,
SAS on Mainframe,
SAS interview Questions and Answers,
SAS Tips and Techniques,
SAS Resources,
SAS Certification questions...
visit http://sastechies.blogspot.com
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
This document provides an overview of new features in Oracle Database 12c for developers and DBAs. It begins with an introduction by Alex Zaballa and then covers several new features including native support for JSON, data redaction, row limits and offsets for SQL queries, PL/SQL functions callable from SQL, session level sequences, and temporary undo. The document includes demonstrations of many of these new features.
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
Oracle Database 12c introduces many new features for developers and DBAs. These include native support for JSON, data redaction capabilities, improved SQL query functionality using row limits and offsets, and new PL/SQL features like calling functions from SQL. The presentation provides demonstrations of these new features.
12cR1 new features. I have tried to cover all new features of 12cR1 and many more may be missing. These are all my own views and do not necessarily reflect the views of Oracle. Requesting all visitors to comment on it to improve further.
This document provides guidelines for developing databases and writing SQL code. It includes recommendations for naming conventions, variables, select statements, cursors, wildcard characters, joins, batches, stored procedures, views, data types, indexes and more. The guidelines suggest using more efficient techniques like derived tables, ANSI joins, avoiding cursors and wildcards at the beginning of strings. It also recommends measuring performance and optimizing for queries over updates.
This document provides an overview of managing data and concurrency in Oracle databases. It covers using SQL to manipulate data through INSERT, UPDATE, DELETE, and MERGE commands. It also describes PL/SQL objects like packages, procedures, functions and triggers. Finally, it discusses how to monitor and resolve locking conflicts that can occur from concurrent transactions through detecting and resolving blocking sessions and deadlocks.
Oracle 11g Institutes : kelly technologies is the best Oracle 11g Training Institutes in Hyderabad. Providing Oracle 11g training by real time faculty in Hyderabad.
The document summarizes how SQL Plan Directives in Oracle 12c can help address issues caused by cardinality misestimation in the optimizer. It provides an example where the optimizer underestimates the number of rows returned by a query on a table due to not having statistics on correlated columns. In 12c, a SQL Plan Directive is automatically generated after the first execution to capture this misestimation. On subsequent queries, the directive can be used to provide more accurate cardinality estimates through automatic reoptimization or dynamic sampling.
The document discusses data manipulation language (DML) statements in SQL. It describes how to insert rows into a table using INSERT, update rows using UPDATE, and delete rows from a table using DELETE. It also covers transaction control using COMMIT to save changes permanently and ROLLBACK to undo pending changes back to a savepoint.
Similar to SQL/MX 3.6 Select for update feature (20)
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
Unveiling the Advantages of Agile Software Development.pdfbrainerhub1
Learn about Agile Software Development's advantages. Simplify your workflow to spur quicker innovation. Jump right in! We have also discussed the advantages.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Drona Infotech is a premier mobile app development company in Noida, providing cutting-edge solutions for businesses.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
A neural network is a machine learning program, or model, that makes decisions in a manner similar to the human brain, by using processes that mimic the way biological neurons work together to identify phenomena, weigh options and arrive at conclusions.
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...kalichargn70th171
In today's business landscape, digital integration is ubiquitous, demanding swift innovation as a necessity rather than a luxury. In a fiercely competitive market with heightened customer expectations, the timely launch of flawless digital products is crucial for both acquisition and retention—any delay risks ceding market share to competitors.
Measures in SQL (SIGMOD 2024, Santiago, Chile)Julian Hyde
SQL has attained widespread adoption, but Business Intelligence tools still use their own higher level languages based upon a multidimensional paradigm. Composable calculations are what is missing from SQL, and we propose a new kind of column, called a measure, that attaches a calculation to a table. Like regular tables, tables with measures are composable and closed when used in queries.
SQL-with-measures has the power, conciseness and reusability of multidimensional languages but retains SQL semantics. Measure invocations can be expanded in place to simple, clear SQL.
To define the evaluation semantics for measures, we introduce context-sensitive expressions (a way to evaluate multidimensional expressions that is consistent with existing SQL semantics), a concept called evaluation context, and several operations for setting and modifying the evaluation context.
A talk at SIGMOD, June 9–15, 2024, Santiago, Chile
Authors: Julian Hyde (Google) and John Fremlin (Google)
https://doi.org/10.1145/3626246.3653374
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid
IBM watsonx Code Assistant for Z, our latest Generative AI-assisted mainframe application modernization solution. Mainframe (IBM Z) application modernization is a topic that every mainframe client is addressing to various degrees today, driven largely from digital transformation. With generative AI comes the opportunity to reimagine the mainframe application modernization experience. Infusing generative AI will enable speed and trust, help de-risk, and lower total costs associated with heavy-lifting application modernization initiatives. This document provides an overview of the IBM watsonx Code Assistant for Z which uses the power of generative AI to make it easier for developers to selectively modernize COBOL business services while maintaining mainframe qualities of service.
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
Preparing Non - Technical Founders for Engaging a Tech AgencyISH Technologies
Preparing non-technical founders before engaging a tech agency is crucial for the success of their projects. It starts with clearly defining their vision and goals, conducting thorough market research, and gaining a basic understanding of relevant technologies. Setting realistic expectations and preparing a detailed project brief are essential steps. Founders should select a tech agency with a proven track record and establish clear communication channels. Additionally, addressing legal and contractual considerations and planning for post-launch support are vital to ensure a smooth and successful collaboration. This preparation empowers non-technical founders to effectively communicate their needs and work seamlessly with their chosen tech agency.Visit our site to get more details about this. Contact us today www.ishtechnologies.com.au
Energy consumption of Database Management - Florina Jonuzi
SQL/MX 3.6 Select for update feature
1. SELECT for UPDATE feature in
NonStop SQL/MX 3.6
Frans Jongma,
Hewlett Packard Enterprise
Advanced Technology Center
NonStop Enterprise Division
Version 1.0
Date: August 2018
Introduction
In order to prevent multiple transactions from updating the same data, Relational Database
Management Systems use locks, typically row locks, to ensure data integrity. Locking data
however, may affect concurrency, because read transactions that require to see only committed
data may need to wait for rows to be released. Database systems that implement the ANSI
isolation levels SERIALIZABLE, REPEATABLE READ, READ COMMITTED and READ
UNCOMMITTED access allow programmers to select the most feasible way to access data and
reduce contention. Another way to improve concurrency is by implementing Multi-Version
Concurrency Control (MVCC). NonStop SQL/MX is an example of the ANSI model, Oracle®
and PostgreSQL are examples of the MVCC method where multiple versions of the same row
exist in the database. (See the paper called "Database consistency in NonStop SQL/MX" for a
detailed description of the differences between Oracle and NonStop SQL/MX. Note however,
that the new SELECT FOR UPDATE feature addresses many of the issues described in that
paper).
Developers who are used to MVCC may find that, unless they change the way the application
locks data, response times may increase because the application spends time to wait for rows
to be released.
NonStop SQL/MX release 3.6 implements SELECT FOR UPDATE. It is a major step in the
Database Compatibility effort, and an additional way to increase concurrency while using the
ANSI isolation method.
Background
Oracle and other databases that use multi-version concurrency control or MVCC, do not allow
"dirty", uncommitted, data to be read. A SELECT will always return committed data, even if the
2. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -2-
row is currently being changed by another transaction. For example, Oracle retrieves a previous
version from the UNDO log while other implementations might keep multiple versions of the
data in the database tables which need to be removed at some time. This means that if a
transaction wants to modify or delete rows that it has just read, it needs to need explicitly lock
the most recent version of those rows. The DML statement "SELECT … FROM <table… > FOR
UPDATE" will try to place a lock on the current version of the row and will wait for any
transaction that holds a write lock to release it.
In the ANSI model, the REPEATABLE READ or SERIALIZABLE access options allow a
transaction to place an exclusive lock on a row until the transaction commits. These reads may
however place more locks than are actually required for the updates: for example, they may
also prevent other transactions from inserting new data into the table.
The SQL/MX SELECT FOR UPDATE feature
NonStop SQL/MX release 3.6 implements SELECT FOR UPDATE. It is a major step in the
Database Compatibility effort, and an additional way to increase concurrency while using the
ANSI isolation method.
SELECT FOR UPDATE will read the data in READ COMMITTED access, and
only rows that match the selection predicates will then be locked exclusively
until the end of the transaction.
Considerations for the FOR UPDATE clause
The feature must be enabled using the DC_MODE or DC_SELECT_FOR_UPDATE CQDs.
This clause is different from the embedded SQL FOR UPDATE clause in a DECLARE
CURSOR statement, which is merely an indicator that the cursor can be updated.
Please see Considerations for FOR UPDATE clause in the SQL/MX 3.6 reference manual on
pages 430-431.
Use cases for SELECT FOR UPDATE
There is a requirement to update the employees that have a current salary of 2500. The rows
need to be retrieved and locked before taking further actions. This sections show how this is
done in SQL/MX before the new feature and how it is done using SELECT FOR UPDATE. The
examples use a simple employee database.
3. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -3-
The example database
Consider a database1
with a JOBS table and an EMPLOYEES table defined as follows.
CREATE TABLE SCH.JOBS
(
JOB_ID VARCHAR2(10) CHARACTER SET ISO88591 NO
DEFAULT -- NOT NULL
, JOB_TITLE VARCHAR2(35) CHARACTER SET ISO88591 NO
DEFAULT -- NOT NULL
, MIN_SALARY NUMERIC(6, 0) DEFAULT NULL
, MAX_SALARY NUMERIC(6, 0) DEFAULT NULL
, CONSTRAINT SCH.JOBS_572372558_1881 PRIMARY KEY (JOB_ID ASC)
, CONSTRAINT SCH.JOBS_667172558_1881 CHECK (SCH.JOBS.JOB_ID IS NOT NULL AND
SCH.JOBS.JOB_TITLE IS NOT NULL)
)
;
CREATE TABLE SCH.EMPLOYEES
(
EMPLOYEE_ID NUMERIC(6, 0) NO DEFAULT -- NOT NULL
, FIRST_NAME VARCHAR2(20) CHARACTER SET ISO88591
DEFAULT NULL
, LAST_NAME VARCHAR2(25) CHARACTER SET ISO88591 NO
DEFAULT -- NOT NULL
, EMAIL VARCHAR2(25) CHARACTER SET ISO88591 NO
DEFAULT -- NOT NULL
, PHONE_NUMBER VARCHAR2(20) CHARACTER SET ISO88591
DEFAULT NULL
, HIRE_DATE DATE NO DEFAULT -- NOT NULL
, JOB_ID VARCHAR2(10) CHARACTER SET ISO88591 NO
DEFAULT -- NOT NULL
, SALARY NUMERIC(8, 2) DEFAULT NULL
, COMMISSION_PCT NUMERIC(2, 2) DEFAULT NULL
, MANAGER_ID NUMERIC(6, 0) DEFAULT NULL
, DEPARTMENT_ID NUMERIC(4, 0) DEFAULT NULL
, CONSTRAINT SCH.EMPLOYEES_168835558_1881 PRIMARY KEY (EMPLOYEE_ID ASC)
, CONSTRAINT SCH.EMPLOYEES_411435558_1881 CHECK (SCH.EMPLOYEES.EMPLOYEE_ID IS
NOT NULL AND SCH.EMPLOYEES.LAST_NAME IS NOT NULL AND SCH.EMPLOYEES.EMAIL
IS NOT NULL AND SCH.EMPLOYEES.HIRE_DATE IS NOT NULL AND
SCH.EMPLOYEES.JOB_ID IS NOT NULL)
)
;
-- The following index is a system created index --
CREATE INDEX EMP_JOB_FK ON SCH.EMPLOYEES
(
JOB_ID ASC
)
;
ALTER TABLE SCH.EMPLOYEES
ADD CONSTRAINT SCH.EMP_EMAIL_UK UNIQUE (EMAIL) DROPPABLE ;
ALTER TABLE SCH.EMPLOYEES
ADD CONSTRAINT SCH.EMP_SALARY_MIN CHECK (SCH.EMPLOYEES.SALARY > 0) DROPPABLE
1 These tables are part of a larger Oracle demo schema that was used demonstrate NonStop SQL/MX
DDL compatibility. Note the use of VARCHAR2 which is another Database Compatibility feature..
4. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -4-
;
ALTER TABLE SCH.EMPLOYEES
ADD CONSTRAINT SCH.EMP_JOB_FK FOREIGN KEY (JOB_ID) REFERENCES
SCH.JOBS(JOB_ID) DROPPABLE ;
Example without using the new feature
Without the feature, the ANSI isolation levels must be used to make sure the resulting rows are
locked.
>>BEGIN WORK;
--- SQL operation complete.
>>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, JOB_ID FROM EMPLOYEES WHERE SALARY =
2500 FOR SERIALIZABLE ACCESS IN EXCLUSIVE MODE;
EMPLOYEE_ID SALARY EMAIL HIRE_DATE JOB_ID
----------- ------------ ------------------------- ---------- ----------
119 2500.00 KCOLMENA 2007-08-10 PU_CLERK
131 2500.00 JAMRLOW 2005-02-16 ST_CLERK
140 2500.00 JPATEL 2006-04-06 ST_CLERK
144 2500.00 PVARGAS 2006-07-09 ST_CLERK
182 2500.00 MSULLIVA 2007-06-21 SH_CLERK
191 2500.00 RPERKINS 2007-12-19 SH_CLERK
--- 6 row(s) selected.
Only 6 rows qualify, however, all rows of the table are now locked, because the query uses a
serial scan through the table and because of the SERIALIZABLE access option, all rows need
to be locked exclusively.
Using FUP to list the locks shows that exclusive locks are place on every row2
.
-LISTLOCKS 'SCHEMA FRANS3_6.SCH', DETAIL
$HD0000.ZSDFJ004.LT7QRG00
ANSI NAME FRANS3_6.SCH.EMPLOYEES
LOCK REQUESTER KEY
TYPE STATE ID LEN KEY/RECORD ADDRESS
F GI TSEK(1).1.860023 LOCK STATE = LK^IX
R G TSEK(1).1.860023 4 ?0 ?0 ?0 ?137 LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 "w" LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 ?144 LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 ?135 LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 "q" LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 ?205 LOCK STATE = LK^X
R G TSEK(1).1.860023 4 ?0 ?0 ?0 ?204 LOCK STATE = LK^X
…
… Omitted 100 additional locks …
2 The first line that FUP shows is a FILE (F) INTENT (I) lock that just prevents other transactions from
obtaining a table-lock. The other locks of type R are row locks.
5. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -5-
Other transactions that require committed access to these rows will wait until
they time out, default 60 seconds, and return with error 73: row locked.
Transactions that use READ UNCOMMITTED access will still be able to see
these rows.Example using the new SELECT FOR UPDATE feature
Because the FOR UPDATE clause is already used in cursor selects to update the “current of
cursor” row, the new feature must be explicitly enabled using a control query default (CQD). The
CQD is called DC_SELECT_FOR_UPDATE and its value must be set to 1.
>>CQD DC_SELECT_FOR_UPDATE '1'; -- Allow the new feature to work
>>BEGIN WORK;
--- SQL operation complete.
>>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, JOB_ID FROM EMPLOYEES WHERE SALARY =
2500 FOR UPDATE;
EMPLOYEE_ID SALARY EMAIL HIRE_DATE JOB_ID
----------- ------------ ------------------------- ---------- ----------
119 2500.00 KCOLMENA 2007-08-10 PU_CLERK
131 2500.00 JAMRLOW 2005-02-16 ST_CLERK
140 2500.00 JPATEL 2006-04-06 ST_CLERK
144 2500.00 PVARGAS 2006-07-09 ST_CLERK
182 2500.00 MSULLIVA 2007-06-21 SH_CLERK
191 2500.00 RPERKINS 2007-12-19 SH_CLERK
--- 6 row(s) selected.
The FUP Listlocks display is now a lot smaller: only 6 rows are locked exclusively.
-LISTLOCKS 'SCHEMA FRANS3_6.SCH', DETAIL
$HD0000.ZSDFJ004.LT7QRG00
ANSI NAME FRANS3_6.SCH.EMPLOYEES
LOCK REQUESTER KEY
TYPE STATE ID LEN KEY/RECORD ADDRESS
F GI TSEK(1).1.860027 LOCK STATE = LK^IX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 ?140 LOCK STATE = LK^UX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 ?144 LOCK STATE = LK^UX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 "w" LOCK STATE = LK^UX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 ?191 LOCK STATE = LK^UX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 ?182 LOCK STATE = LK^UX
R G TSEK(1).1.860027 4 ?0 ?0 ?0 ?131 LOCK STATE = LK^UX
-
6. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -6-
Now, only transactions that try to read these rows with READ COMMITTED or higher isolation
will encounter these locks. This is an example how the SELECT FOR UPDATE feature can
greatly improve concurrency of transactions.
Selecting and locking rows from multiple tables
But what if there are more tables involved? Consider the following example, where we select
employees with JOB_ID ‘SH_CLERK’ who earn the minimum salary of that job.
>>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+>AND J.JOB_ID = 'SH_CLERK'
+>AND SALARY = MIN_SALARY
+>FOR UPDATE OF E.SALARY
+>;
EMPLOYEE_ID SALARY EMAIL HIRE_DATE JOB_ID
----------- ------------ ------------------------- ---------- ----------
182 2500.00 MSULLIVA 2007-06-21 SH_CLERK
191 2500.00 RPERKINS 2007-12-19 SH_CLERK
--- 2 row(s) selected.
~> fup "LISTLOCKS 'SCHEMA FRANS3_6.SCH', DETAIL"
$HD0000.ZSDFJ004.LT7QRG00
ANSI NAME FRANS3_6.SCH.EMPLOYEES
LOCK REQUESTER KEY
TYPE STATE ID LEN KEY/RECORD ADDRESS
F GI TSEK(1).3.46871 LOCK STATE = LK^IX
R G TSEK(1).3.46871 4 ?0 ?0 ?0 ?191 LOCK STATE = LK^UX
R G TSEK(1).3.46871 4 ?0 ?0 ?0 ?182 LOCK STATE = LK^UX
Again, only two qualifying rows from the employees table are locked. With SERIALIZABLE
access however, the row in the JOBS table would have been locked in addition to all the rows in
the EMPLOYEES table.
The number of rows that are locked depends on the chosen execution plan regardless whether
SELECT FOR UDATE or SERIALIZABLE access is used. The next section provides more
details on how the execution plan influences the amount of locking that takes place.
7. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -7-
How the execution plan affects the number of rows locked
The ANSI isolation levels SERIALIZABLE and REPEATABLE are used to place read and write
locks for the duration of a transaction during a SELECT query. The SERIALIZABLE isolation
level even prevents other transactions to insert rows to assure the same result when the query
executes a second time within the same transaction. SQL/MX has implemented REPEATABLE
access the same a SERIALIZABLE and therefore, all rows of a table may be locked for a query
that performs a full table scan.
With SELECT FOR UPDATE, the executor that runs in DP2 (the “Executor-in-DP2 or EID) only
places a lock if the row passes the executor predicate of the particular node in the query plan.
The following example illustrates this.
SELECT * FROM JOBS WHERE JOB_TITLE = 'Shipping Clerk' FOR SERIALIZABLE ACCESS IN
EXCLUSIVE MODE;
A full table scan of the JOBS table is performed, and all rows will get an exclusive lock. The next
query access the table via its primary key and will only lock the single row with the selected
value. No other row with this key value can be added, so a single row lock is sufficient..
SELECT * FROM JOBS WHERE JOB_ID = 'SH_CLERK' FOR SERIALIZABLE ACCESS IN EXCLUSIVE
MODE;
A query that uses SELECT FOR UPDATE will lock only those rows that match the WHERE
clause, not any other rows.
SELECT * FROM JOBS WHERE JOB_TITLE = 'Shipping Clerk' FOR UPDATE;
Below is the DP2 plan fragment of this query. It shows the executor predicate that is executed
by DP2 when filtering datqa that comes off the disk. The rows that pass the predicate will get a
write (exclusive) lock.
FILE_SCAN ================================= SEQ_NO 1 NO CHILDREN
TABLE_NAME ............... FRANS3_6.SCH.JOBS
REQUESTS_IN .............. 1
ROWS_OUT ................. 1
EST_OPER_COST ............ 0.01
EST_TOTAL_COST ........... 0.01
DESCRIPTION
max_card_est ........... 1
fragment_id ............ 2
parent_frag ............ 0
fragment_type .......... dp2
olt_optimization ....... not used
olt_opt_lean ........... not used
scan_type .............. full scan of table FRANS3_6.SCH.JOBS
scan_direction ......... forward
key_type ............... simple
lock_state ............. cursor
consistency_level ...... read_committed
columns_retrieved ...... 4
8. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -8-
fast_replydata_move .... used
Scan_Lock_For_Write .... Yes
key_columns ............ JOB_ID
executor_predicates .... (JOB_TITLE = 'Shipping Clerk')
begin_key .............. (JOB_ID = '<min>')
end_key ................ (JOB_ID = '<max>')
Nested joins are preferred
The executor predicates that are handled by DP2 greatly determine the number of rows that are
actually locked for update. However when tables are joined, not all join-types are equal in how
the EID receives its executor predicates.
When tables are joined using a nested join, the join predicate will be pushed down to the EID,
but when tables are joined using a hash join or a merge join, the actual join predicate is not
visible to DP2. Consider the two following examples, the first one selects the employees that
earn the minimum wage for job title Clerks (as indicated by the search argument ‘%Clerk’, the
other does the same for employees regardless of job title.
Example 1: Hash join
>>EXPLAIN OPTIONS 'f'
+>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID , MIN_SALARY , JOB_TITLE
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+> AND SALARY = MIN_SALARY
+>FOR UPDATE OF SALARY
+>;
LC RC OP OPERATOR OPT DESCRIPTION CARD
---- ---- ---- -------------------- -------- -------------------- ---------
5 . 6 root 1.90E+001
4 2 5 hybrid_hash_join 1.90E+001
3 . 4 partition_access 1.06E+002
. . 3 file_scan fr EMPLOYEES (s) 1.06E+002
1 . 2 partition_access 1.90E+001
. . 1 file_scan fr JOBS (s) 1.90E+001
--- SQL operation complete.
The two tables are joined using a hybrid hash join. The JOBS table is the inner table and a hash
table of (JOB_ID, MIN_SALARY) will be built by the executor that runs inside the program. The
EMPLOYEES table is scanned and every row is matched against the hash table. The DP2
fragment for EMPLOYEES is shown below:
9. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -9-
FILE_SCAN ================================= SEQ_NO 3 NO CHILDREN
TABLE_NAME ............... E (FRANS3_6.SCH.EMPLOYEES)
REQUESTS_IN .............. 1
ROWS_OUT ............... 107
EST_OPER_COST ............ 0.02
EST_TOTAL_COST ........... 0.02
DESCRIPTION
max_card_est ......... 107
fragment_id ............ 3
parent_frag ............ 0
fragment_type .......... dp2
olt_optimization ....... not used
olt_opt_lean ........... not used
scan_type .............. full scan of table FRANS3_6.SCH.EMPLOYEES E
scan_direction ......... forward
key_type ............... simple
lock_state ............. cursor
consistency_level ...... read_committed
columns_retrieved ..... 11
fast_replydata_move .... used
Scan_Lock_For_Write .... Yes
key_columns ............ EMPLOYEE_ID
executor_predicates .... SALARY is not null
begin_key .............. (EMPLOYEE_ID = <min>)
end_key ................ (EMPLOYEE_ID = <max>)
The only executor predicate for employees is “SALARY is not NULL”, so all rows from
employees that have a salary will be locked for a possible update.
Example 2: Nested join
Adding an extra predicate causes the cardinality to be low and so the optimizer selects a nested
join as is shown in operation 5 below.
>>EXPLAIN OPTIONS 'f'
+>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID , MIN_SALARY , JOB_TITLE
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+> AND SALARY = MIN_SALARY
+> AND JOB_TITLE LIKE '%Clerk'
+>FOR UPDATE OF SALARY
+>;
LC RC OP OPERATOR OPT DESCRIPTION CARD
---- ---- ---- -------------------- -------- -------------------- ---------
5 . 6 root 2.00E+000
2 4 5 nested_join 2.00E+000
3 . 4 partition_access 1.00E+000
. . 3 file_scan fr EMPLOYEES (s) 1.00E+000
1 . 2 partition_access 1.00E+000
. . 1 file_scan fr JOBS (s) 1.00E+000
10. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -10-
--- SQL operation complete.
Now, the EMPLOYEES table is the inner table and the DP2 fragment includes the join
predicate.
FILE_SCAN ================================= SEQ_NO 3 NO CHILDREN
TABLE_NAME ............... E (FRANS3_6.SCH.EMPLOYEES)
REQUESTS_IN .............. 1
ROWS_OUT ................. 1
EST_OPER_COST ............ 0.01
EST_TOTAL_COST ........... 0.01
DESCRIPTION
max_card_est ......... 107
fragment_id ............ 3
parent_frag ............ 0
fragment_type .......... dp2
olt_optimization ....... not used
olt_opt_lean ........... not used
scan_type .............. full scan of table FRANS3_6.SCH.EMPLOYEES E
scan_direction ......... forward
key_type ............... simple
lock_state ............. cursor
consistency_level ...... read_committed
columns_retrieved ..... 11
fast_replydata_move .... used
Scan_Lock_For_Write .... Yes
key_columns ............ EMPLOYEE_ID
executor_predicates .... (JOB_ID = FRANS3_6.SCH.JOBS.JOB_ID) and (SALARY =
cast((FRANS3_6.SCH.JOBS.MIN_SALARY * 100) AS
NUMERIC(8,2) SIGNED))
begin_key .............. (EMPLOYEE_ID = <min>)
end_key ................ (EMPLOYEE_ID = <max>)
Because the join predicate from the nested join in operation 5 is copied down to the EID in
operation 3, only the rows in EMPLOYEES that pass the join criteria are locked.
Note 1: This example may involve multiple scans through the employee table if there are
multiple rows in the JOB table that match the WHERE clause.
Note 2: Be advised that an optimizer join hint can be used to change the join from hash to
nested. Example 1 can be written with such a hint as:
SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID , MIN_SALARY , JOB_TITLE
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+> AND SALARY = MIN_SALARY
+>FOR UPDATE OF SALARY
+>USING <<+ USE_NESTEDJOIN( E,J) >>
+>;
11. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -11-
Further improving concurrency
Be sure you do not lock rows from tables that you do not want to update. If multiple table are
joined to form a result set, be sure to add the column names from the table(s) that need to be
locked. When no columns are specified in the FOR UPDATE OF clause, SQL/MX will lock rows
from every table in the join.
Skip over existing locks
A common technique to increase concurrency is to skip over existing locked rows. SELECT
FOR UPDATE supports the SKIP LOCKED option. When used, SQL/MX will continue reading
the data and return and lock only those that are not locked by other transactions.3
>>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID , MIN_SALARY , JOB_TITLE
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+> AND SALARY = MIN_SALARY
+> AND JOB_TITLE LIKE '%Clerk'
+>FOR UPDATE OF SALARY SKIP LOCKED;
NOWAIT, or return if locked
Some applications may decide not to wait for locked rows, but immediately return the locked
status to the user. In Oracle SQL the NOWAIT option can be used, this needs to be rephrased
in SQL/MX using an optimizer control hint as shown below.
>>SELECT EMPLOYEE_ID, SALARY, EMAIL,HIRE_DATE, E.JOB_ID , MIN_SALARY , JOB_TITLE
+>FROM EMPLOYEES E, JOBS J
+>WHERE
+> E.JOB_ID = J.JOB_ID
+> AND SALARY = MIN_SALARY
+> AND JOB_TITLE LIKE '%Clerk'
+>FOR UPDATE OF SALARY
+>WITH CQD IF_LOCKED 'RETURN';
*** ERROR[8551] Error 73 was returned by the file system on FRANS3_6.SCH.EMPLOYEES
(partition TSEK.$HD0000.ZSDFJ004.LT7QRG00).
--- 0 row(s) selected.
Conclusion
When applications were migrated to NonStop SQL from databases that use MVCC to manage
consistence and concurrency, prior to Release 3.6, the application may have required DML
3 SKIP LOCKED is similar to existing functionality of SKIP CONFLICT ACCESS in a SELECT. However,
for compatibility reasons SELECT FOR UPDATE requires the use of SKIP LOCKED.
12. NonStop Advanced Technology Center
SELECT for UPDATE feature in NonStop SQL/MX 3.6 -12-
changes to lock rows before they could be updated or deleted. Such changes could lead to a
higher frequency of transactions waiting for locks to be releases. With the support of SELECT
FOR UPDATE, fewer DLM changes are needed and a finer granularity of exclusive locks has
been achieved. Migration to NonStop SQL has become much easier.