MariaDB: Engine Independent Table Statistics, including histogramsSergey Petrunya
EITS (Engine Independent Table Statistics) provides new statistics for MariaDB query optimization, including histograms for column value distributions. These statistics must be manually collected with ANALYZE TABLE and enabled to improve estimates for queries using non-indexed columns and ranges. With EITS, the optimizer can better estimate row counts and filtering for joins and WHERE clauses.
This document summarizes new features in the MariaDB 10.0 query optimizer, including:
1. Engine-independent statistics like histograms that are collected via ANALYZE TABLE instead of random sampling.
2. New subquery optimizations that convert EXISTS subqueries to inner joins and trivially correlated EXISTS to IN.
3. EXPLAIN improvements like SHOW EXPLAIN to see EXPLAIN plans for running queries, and logging EXPLAIN output in the slow query log.
The document summarizes several new features in the MariaDB and MySQL query optimizers, including:
1) Subquery optimizations that improved subquery performance from orders of magnitude slower to on par with other databases. These optimizations are available in MariaDB 5.3/5.5 and MySQL 5.6.
2) Batched Key Access, which speeds up large IO-bound joins by accessing keys in batches rather than randomly, improving performance by orders of magnitude.
3) Index Condition Pushdown, which pushes SELECT conditions into indexes to filter records before reading the table, improving performance for IO-bound queries similar to "Using index".
Informix Warehouse Accelerator (IWA) features in version 12.1Keshav Murthy
The document discusses enhancements made to Informix Warehouse Accelerator (IWA) in version 12.10. Key points include:
- IWA now supports operations like creating, deploying, loading, enabling, and disabling data marts on secondary nodes in MACH11 and high availability environments, in addition to the primary/standard server node.
- New procedures like dropPartMart and loadPartMart allow refreshing partitions in a partitioned fact table within a data mart.
- Performance of SQL queries involving UNIONs, derived tables, and DISTINCT aggregates was improved.
- Additional OLAP functions and options like NULLS FIRST/LAST in ORDER BY were added for enhanced analytical querying.
1. The document discusses two methods for explaining SQL execution plans without executing the query: using the EXPLAIN PLAN statement and the GATHER_PLAN_STATISTICS hint.
2. It explains the components of an execution plan such as operation IDs, costs, and predicate information. Filter operations may validate logic before child operations execute.
3. Displaying execution plan statistics with DBMS_XPLAN after running a query with GATHER_PLAN_STATISTICS shows runtime metrics like number of rows and buffers accessed.
The document discusses Cassandra Storage Engine (Cassandra SE) in MariaDB, which allows MariaDB to access Cassandra data. Cassandra SE provides a SQL view of Cassandra data by mapping Cassandra concepts like column families to MariaDB tables. It supports basic operations like SELECT, INSERT, and UPDATE between the two systems. The document outlines use cases, benchmarks Cassandra SE performance, and discusses future directions like supporting additional Cassandra features.
Oracle 12c Automatic Data Optimization (ADO) - ILMMonowar Mukul
Automatic Data Optimization (ADO) automatically moves and compresses data according to user-defined policies based on statistics collected by Heat Map. Heat Map tracks data access patterns at the row and segment levels. ADO policies can be defined to compress or move segments after a specified number of days with no modifications. When testing compression policies, ADO automatically compressed the SALES_ADO table after 20 days of no modifications, as determined by simulated Heat Map statistics.
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013Sergey Petrunya
The document discusses techniques for identifying and addressing problems with a database query optimizer. It describes old and new tools for catching slow queries, such as the slow query log, SHOW PROCESSLIST, and the Performance Schema. It also provides examples of using these tools to analyze query plans, identify inefficient plans, and determine if optimizer settings or query structure need to be modified to address performance issues.
MariaDB: Engine Independent Table Statistics, including histogramsSergey Petrunya
EITS (Engine Independent Table Statistics) provides new statistics for MariaDB query optimization, including histograms for column value distributions. These statistics must be manually collected with ANALYZE TABLE and enabled to improve estimates for queries using non-indexed columns and ranges. With EITS, the optimizer can better estimate row counts and filtering for joins and WHERE clauses.
This document summarizes new features in the MariaDB 10.0 query optimizer, including:
1. Engine-independent statistics like histograms that are collected via ANALYZE TABLE instead of random sampling.
2. New subquery optimizations that convert EXISTS subqueries to inner joins and trivially correlated EXISTS to IN.
3. EXPLAIN improvements like SHOW EXPLAIN to see EXPLAIN plans for running queries, and logging EXPLAIN output in the slow query log.
The document summarizes several new features in the MariaDB and MySQL query optimizers, including:
1) Subquery optimizations that improved subquery performance from orders of magnitude slower to on par with other databases. These optimizations are available in MariaDB 5.3/5.5 and MySQL 5.6.
2) Batched Key Access, which speeds up large IO-bound joins by accessing keys in batches rather than randomly, improving performance by orders of magnitude.
3) Index Condition Pushdown, which pushes SELECT conditions into indexes to filter records before reading the table, improving performance for IO-bound queries similar to "Using index".
Informix Warehouse Accelerator (IWA) features in version 12.1Keshav Murthy
The document discusses enhancements made to Informix Warehouse Accelerator (IWA) in version 12.10. Key points include:
- IWA now supports operations like creating, deploying, loading, enabling, and disabling data marts on secondary nodes in MACH11 and high availability environments, in addition to the primary/standard server node.
- New procedures like dropPartMart and loadPartMart allow refreshing partitions in a partitioned fact table within a data mart.
- Performance of SQL queries involving UNIONs, derived tables, and DISTINCT aggregates was improved.
- Additional OLAP functions and options like NULLS FIRST/LAST in ORDER BY were added for enhanced analytical querying.
1. The document discusses two methods for explaining SQL execution plans without executing the query: using the EXPLAIN PLAN statement and the GATHER_PLAN_STATISTICS hint.
2. It explains the components of an execution plan such as operation IDs, costs, and predicate information. Filter operations may validate logic before child operations execute.
3. Displaying execution plan statistics with DBMS_XPLAN after running a query with GATHER_PLAN_STATISTICS shows runtime metrics like number of rows and buffers accessed.
The document discusses Cassandra Storage Engine (Cassandra SE) in MariaDB, which allows MariaDB to access Cassandra data. Cassandra SE provides a SQL view of Cassandra data by mapping Cassandra concepts like column families to MariaDB tables. It supports basic operations like SELECT, INSERT, and UPDATE between the two systems. The document outlines use cases, benchmarks Cassandra SE performance, and discusses future directions like supporting additional Cassandra features.
Oracle 12c Automatic Data Optimization (ADO) - ILMMonowar Mukul
Automatic Data Optimization (ADO) automatically moves and compresses data according to user-defined policies based on statistics collected by Heat Map. Heat Map tracks data access patterns at the row and segment levels. ADO policies can be defined to compress or move segments after a specified number of days with no modifications. When testing compression policies, ADO automatically compressed the SALES_ADO table after 20 days of no modifications, as determined by simulated Heat Map statistics.
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013Sergey Petrunya
The document discusses techniques for identifying and addressing problems with a database query optimizer. It describes old and new tools for catching slow queries, such as the slow query log, SHOW PROCESSLIST, and the Performance Schema. It also provides examples of using these tools to analyze query plans, identify inefficient plans, and determine if optimizer settings or query structure need to be modified to address performance issues.
Single-row functions allow users to manipulate data within SQL queries. Common types include character, number, date, and conversion functions. Character functions modify strings, number functions perform calculations, date functions work with dates, and conversion functions change data types. Functions are useful for formatting output, performing calculations on individual rows, and conditional processing.
Common Table Expressions in MariaDB 10.2 (Percona Live Amsterdam 2016)Sergey Petrunya
- Common Table Expressions (CTEs) allow temporary named results to be stored and reused within a single SQL statement.
- There are two types of CTEs: non-recursive and recursive. Non-recursive CTEs can refer to other CTEs but not recursively, while recursive CTEs define a recursive relationship between rows.
- Optimizations for non-recursive CTEs in MariaDB include merging CTEs into joins and pushing conditions down into CTEs to filter groups. Recursive CTEs are used to query hierarchical or graph-like recursive relationships in a table.
This document discusses various built-in functions in MySQL including date functions, string functions, and numeric functions. It provides examples of functions such as DATE_FORMAT() to format dates, CONCAT() to concatenate strings, and FLOOR() to round numbers down. Various functions are demonstrated on sample data from a cds table to manipulate and extract date, string, and numeric values.
Oracle12 - The Top12 Features by NAYA TechnologiesNAYATech
The document discusses the top 12 new features of Oracle 12c, as presented by David Yahalom of NAYA Technologies. It covers improved column defaults, increased size limits, improved top-N queries, temporary UNDO, new partitioning features, transaction guard, adaptive execution plans, enhanced statistics, data optimization and information lifecycle management (ILM), row pattern matching, and a 50% discount code for a Oracle performance tuning seminar offered by NAYA Technologies.
The document discusses histograms in Oracle databases before and after Oracle 12c. It describes the different types of histograms including frequency histograms, height-balanced histograms, top frequency histograms, and hybrid histograms. It highlights issues with histograms in Oracle 11g and how Oracle 12c introduced new histogram types to improve cardinality estimates.
The document discusses the different types of SQL statements - DDL, DML, DCL, and TCL. It then provides details on data types supported by Oracle databases from version 9i to 11g including character, numeric, date/time, LOB, and rowid data types. The document concludes with sections on the CREATE TABLE statement and constraints that can be defined while creating a table.
The document discusses window functions in MariaDB. It begins with an overview and plan, then covers basic window functions like row_number(), rank(), dense_rank(), and ntile(). It discusses frames for window functions, including examples using RANGE frames. It provides examples of problems that can be solved using window functions, such as smoothing noisy data, generating account balance statements, and finding sequences with no missing numbers ("islands").
The document provides information about the history and techniques of stained glass art. It discusses how stained glass was used extensively in Gothic cathedrals to decorate walls and windows with biblical scenes. Specific examples are given of early Gothic churches like St. Denis that featured stained glass windows. The document then provides instructions for a student project to design and create a stained glass window depicting a saint using black construction paper and tissue paper to simulate stained glass. Examples of student projects featuring saints are presented.
This document discusses the impact of globalization on human resources. It begins by defining globalization and noting its origins. It then outlines three types of globalized businesses: import-export firms, multinational enterprises, and global firms. The document lists advantages like increased ease of trade and connectivity, as well as disadvantages such as increasing work intensification. It also examines environmental factors that affect globalization, including economic, policy, technological, demographic, and social/cultural factors. It provides examples of how to address some of these factors from an HR perspective.
This document discusses the causes and effects of globalization. It identifies five key causes: improved communications, improved transport, free trade agreements, global banking, and the growth of multinational corporations. Some effects mentioned are a changed global food supply with year-round availability, offshoring of manufacturing jobs to lower costs, less job security, environmental damage from increased transport, cultural impacts from the spread of media, and more anti-globalization protests. The rapid growth of multinational corporations both drives and benefits from increased globalization.
Liztek HDD Docking Station is the best Device for All laptop and Desktop buy now from Amazon and Walmart marketplace in the USA at lowest price with 1 year replacement warranty.
World War I began in 1914 after the assassination of Archduke Franz Ferdinand of Austria-Hungary by a Serbian nationalist. This sparked conflict between the Allied powers of Britain, France, and Russia against the Central powers of Germany and Austria-Hungary. The United States initially remained neutral but entered the war in 1917 on the side of the Allies after German submarine attacks and the Zimmerman Telegram. The war was characterized by new military technologies like machine guns, tanks, airplanes, and poison gas, as well as brutal trench warfare with immense loss of life.
The document provides an overview of World War 1, including its causes such as militarism, alliances, and imperialism. It describes the major events and theaters of the war, from the initial Schlieffen Plan to the trench warfare on the Western Front. It also highlights the massive human costs of the war, with over 9 million soldiers killed and many civilian casualties due to new military technologies and a worldwide flu pandemic in 1918.
The document provides background information on the causes of World War I, including militarism, alliances, nationalism, imperialism, and assassination. It discusses key events that led to the outbreak of war in 1914, such as the assassination of Archduke Franz Ferdinand, Germany declaring war on Russia and France, and the invasion of Belgium. It also summarizes some major battles of WWI on the Western and Eastern Fronts, including the First Battle of the Marne in 1914, the Gallipoli Campaign in 1915, the Battles of Verdun and the Somme in 1916, and the German offensives and breaking of the Hindenburg Line in 1918.
Globalization is a process that involves the worldwide integration of economies, technologies, and cultures. It began accelerating in the late 20th century due to advances in transportation and communication technology. While globalization has led to increased economic opportunities through expanded trade and investment, it has also contributed to cultural and economic homogenization. It has impacted systems of governance, urban development, labor markets, and gender norms around the world. Both supporters and critics of globalization make arguments around its effects on issues like sovereignty, inequality, and cultural diversity.
Globalization refers to the increasing interconnectedness of economies and societies around the world through trade and information sharing. There are three main types - economic, social, and political. Key drivers of globalization include improved communications like the internet, improved transportation infrastructure, free trade agreements, global banking, and the growth of multinational corporations. The effects of globalization include a changed global food supply, increased outsourcing and less job security in some countries, potential environmental damage from increased trade and transport, homogenization of cultures, and a rise in anti-globalization protests.
The document discusses globalization and how technology promotes it. Globalization is defined as the standardization of everyday life worldwide through the spread of ideas and commodities. Technology tools like social media, video chatting, and email allow people all over the world to communicate and share information instantly. This connectivity has opened up educational opportunities for students by giving them access to more in-depth global information. Places that used to seem distant can now be experienced virtually through technology with the click of a button.
Single-row functions allow users to manipulate data within SQL queries. Common types include character, number, date, and conversion functions. Character functions modify strings, number functions perform calculations, date functions work with dates, and conversion functions change data types. Functions are useful for formatting output, performing calculations on individual rows, and conditional processing.
Common Table Expressions in MariaDB 10.2 (Percona Live Amsterdam 2016)Sergey Petrunya
- Common Table Expressions (CTEs) allow temporary named results to be stored and reused within a single SQL statement.
- There are two types of CTEs: non-recursive and recursive. Non-recursive CTEs can refer to other CTEs but not recursively, while recursive CTEs define a recursive relationship between rows.
- Optimizations for non-recursive CTEs in MariaDB include merging CTEs into joins and pushing conditions down into CTEs to filter groups. Recursive CTEs are used to query hierarchical or graph-like recursive relationships in a table.
This document discusses various built-in functions in MySQL including date functions, string functions, and numeric functions. It provides examples of functions such as DATE_FORMAT() to format dates, CONCAT() to concatenate strings, and FLOOR() to round numbers down. Various functions are demonstrated on sample data from a cds table to manipulate and extract date, string, and numeric values.
Oracle12 - The Top12 Features by NAYA TechnologiesNAYATech
The document discusses the top 12 new features of Oracle 12c, as presented by David Yahalom of NAYA Technologies. It covers improved column defaults, increased size limits, improved top-N queries, temporary UNDO, new partitioning features, transaction guard, adaptive execution plans, enhanced statistics, data optimization and information lifecycle management (ILM), row pattern matching, and a 50% discount code for a Oracle performance tuning seminar offered by NAYA Technologies.
The document discusses histograms in Oracle databases before and after Oracle 12c. It describes the different types of histograms including frequency histograms, height-balanced histograms, top frequency histograms, and hybrid histograms. It highlights issues with histograms in Oracle 11g and how Oracle 12c introduced new histogram types to improve cardinality estimates.
The document discusses the different types of SQL statements - DDL, DML, DCL, and TCL. It then provides details on data types supported by Oracle databases from version 9i to 11g including character, numeric, date/time, LOB, and rowid data types. The document concludes with sections on the CREATE TABLE statement and constraints that can be defined while creating a table.
The document discusses window functions in MariaDB. It begins with an overview and plan, then covers basic window functions like row_number(), rank(), dense_rank(), and ntile(). It discusses frames for window functions, including examples using RANGE frames. It provides examples of problems that can be solved using window functions, such as smoothing noisy data, generating account balance statements, and finding sequences with no missing numbers ("islands").
The document provides information about the history and techniques of stained glass art. It discusses how stained glass was used extensively in Gothic cathedrals to decorate walls and windows with biblical scenes. Specific examples are given of early Gothic churches like St. Denis that featured stained glass windows. The document then provides instructions for a student project to design and create a stained glass window depicting a saint using black construction paper and tissue paper to simulate stained glass. Examples of student projects featuring saints are presented.
This document discusses the impact of globalization on human resources. It begins by defining globalization and noting its origins. It then outlines three types of globalized businesses: import-export firms, multinational enterprises, and global firms. The document lists advantages like increased ease of trade and connectivity, as well as disadvantages such as increasing work intensification. It also examines environmental factors that affect globalization, including economic, policy, technological, demographic, and social/cultural factors. It provides examples of how to address some of these factors from an HR perspective.
This document discusses the causes and effects of globalization. It identifies five key causes: improved communications, improved transport, free trade agreements, global banking, and the growth of multinational corporations. Some effects mentioned are a changed global food supply with year-round availability, offshoring of manufacturing jobs to lower costs, less job security, environmental damage from increased transport, cultural impacts from the spread of media, and more anti-globalization protests. The rapid growth of multinational corporations both drives and benefits from increased globalization.
Liztek HDD Docking Station is the best Device for All laptop and Desktop buy now from Amazon and Walmart marketplace in the USA at lowest price with 1 year replacement warranty.
World War I began in 1914 after the assassination of Archduke Franz Ferdinand of Austria-Hungary by a Serbian nationalist. This sparked conflict between the Allied powers of Britain, France, and Russia against the Central powers of Germany and Austria-Hungary. The United States initially remained neutral but entered the war in 1917 on the side of the Allies after German submarine attacks and the Zimmerman Telegram. The war was characterized by new military technologies like machine guns, tanks, airplanes, and poison gas, as well as brutal trench warfare with immense loss of life.
The document provides an overview of World War 1, including its causes such as militarism, alliances, and imperialism. It describes the major events and theaters of the war, from the initial Schlieffen Plan to the trench warfare on the Western Front. It also highlights the massive human costs of the war, with over 9 million soldiers killed and many civilian casualties due to new military technologies and a worldwide flu pandemic in 1918.
The document provides background information on the causes of World War I, including militarism, alliances, nationalism, imperialism, and assassination. It discusses key events that led to the outbreak of war in 1914, such as the assassination of Archduke Franz Ferdinand, Germany declaring war on Russia and France, and the invasion of Belgium. It also summarizes some major battles of WWI on the Western and Eastern Fronts, including the First Battle of the Marne in 1914, the Gallipoli Campaign in 1915, the Battles of Verdun and the Somme in 1916, and the German offensives and breaking of the Hindenburg Line in 1918.
Globalization is a process that involves the worldwide integration of economies, technologies, and cultures. It began accelerating in the late 20th century due to advances in transportation and communication technology. While globalization has led to increased economic opportunities through expanded trade and investment, it has also contributed to cultural and economic homogenization. It has impacted systems of governance, urban development, labor markets, and gender norms around the world. Both supporters and critics of globalization make arguments around its effects on issues like sovereignty, inequality, and cultural diversity.
Globalization refers to the increasing interconnectedness of economies and societies around the world through trade and information sharing. There are three main types - economic, social, and political. Key drivers of globalization include improved communications like the internet, improved transportation infrastructure, free trade agreements, global banking, and the growth of multinational corporations. The effects of globalization include a changed global food supply, increased outsourcing and less job security in some countries, potential environmental damage from increased trade and transport, homogenization of cultures, and a rise in anti-globalization protests.
The document discusses globalization and how technology promotes it. Globalization is defined as the standardization of everyday life worldwide through the spread of ideas and commodities. Technology tools like social media, video chatting, and email allow people all over the world to communicate and share information instantly. This connectivity has opened up educational opportunities for students by giving them access to more in-depth global information. Places that used to seem distant can now be experienced virtually through technology with the click of a button.
The document summarizes major events from World War I through World War II. WWI began in 1914 due to imperial competition and nationalism, and involved trench warfare between the Allied and Central powers. After US entry in 1917, an armistice was reached in 1918. The Treaty of Versailles in 1919 imposed punitive terms on Germany. Economic instability in the 1920s led to the Great Depression. Roosevelt responded with the New Deal in the 1930s. WWII began in 1939 with Germany invading Poland. The US entered in 1941 after Pearl Harbor. Key battles involved Stalingrad, Midway, and Hiroshima/Nagasaki. WWII ended in 1945 with the defeat of Germany, Italy and Japan, and the establishment of the United Nations
International relations refers to the interactions between countries, including states, intergovernmental organizations, non-governmental organizations, and multinational corporations. As an academic discipline, international relations studies how these different actors cooperate and conflict across borders. The key factors that influence relations between countries include geographic, economic, demographic, and strategic considerations. Geography, the size of a country's population and economy, and strategic location all impact a country's foreign policy and interactions with other international actors.
The document discusses various aspects of globalization including:
1) Globalization refers to the increasing integration and interaction between countries through international trade, flow of capital and technology.
2) Key drivers of globalization include multinational corporations, the WTO, World Bank and IMF.
3) Firms operate globally to access new markets, raw materials, labor and gain economies of scale. However, globalization benefits are not evenly distributed.
World War II was the largest war in human history, involving countries around the globe from 1939 to 1945. Over 70 million people were killed by the end of the war. The war was sparked by the aftermath of World War I and rise of totalitarian regimes in Germany, Italy, and Japan led by Hitler, Mussolini, and Tojo seeking to expand their territories. The war began when Germany invaded Poland in 1939 and soon involved most major world powers aligned into two opposing military alliances: the Allies and the Axis powers.
The document describes several databases related to banking, insurance, orders, students, and books. It includes the structure of each database with table definitions and sample data. Various SQL queries are demonstrated to retrieve, update, insert and delete records in the tables to solve business problems for each database application.
The document discusses several topics related to SQL:
1) SQLNet compression - How ordering data in a query can significantly reduce the amount of data sent over the network by compressing repeated values. Ordering by additional columns further improves compression.
2) NULLs and indexes - There is a misconception that indexes cannot be used with queries involving NULL values, but indexes can support queries searching for NULL values.
3) Subquery caching - Repeated scalar subqueries are cached and evaluated only once to improve performance of queries containing subqueries.
The document discusses various methods for profiling and optimizing Odoo and PostgreSQL performance, including:
- Using built-in and third-party profilers like snakeviz to identify slow Python methods in Odoo.
- Configuring PostgreSQL logging and using tools like pgbadger to analyze logs and find slow SQL queries.
- Optimizing SQL queries by adding indexes, removing functions from indexes, and using EXPLAIN ANALYZE to understand query plans.
- Using SQL constraints instead of Python constraints for performance, but being aware they are harder to update frequently.
SQL Macros - Game Changing Feature for SQL Developers?Andrej Pashchenko
SQL Macros are functions that return SQL statements as text. When called in a SQL statement, the returned SQL text is parsed and optimized rather than executing the function at runtime. This avoids context switches to PL/SQL and allows the optimizer to see the full SQL. Table SQL macros can be called in the FROM clause and act like views or inline queries, except they allow parameters to make the views polymorphic. Scalar parameters in the returned SQL text are substituted like bind variables to make the macros more reusable and flexible.
The document contains SQL statements and execution plans for counting records in a table where the ID is between 1 and 10 and the status is either '00' or '01'. It shows that for a status of '00' there are 10000 records, but for a status of '01' there are 0 records. Execution plans and statistics are provided with each statement to analyze the performance and resource usage.
The document discusses various built-in functions in MySQL for manipulating date, time, string, and numeric data. It describes functions for formatting dates, extracting date elements, adding or subtracting times, concatenating and modifying strings. Common functions covered include DATE_FORMAT(), NOW(), CURDATE(), CONCAT(), REPLACE(), LEFT(), RIGHT(), and MID().
This document provides an overview of temporal tables in MariaDB. It discusses:
- The history of temporal table implementations in proprietary and open source databases.
- How MariaDB supports both system-time and application-time temporal tables, allowing tables to track changes over time.
- Examples of creating and querying application-time tables to track ticket changes, and system-versioning tables to store row versions.
- Best practices for indexes, queries, and handling deletes/updates when using temporal tables.
- Potential future extensions and limitations, like improved datetime support and issues with certain storage engines.
Single-row functions can manipulate data items, accept arguments and return one value, and act on each row returned. There are various types of single-row functions including character, number, date, and conversion functions. Character functions manipulate character strings, number functions perform calculations, and date functions modify date formats. Functions allow data to be formatted, calculated, and converted as needed for different queries and outputs.
A few things about the Oracle optimizer - 2013Connor McDonald
The document discusses how using the wrong data types for columns in a database table can negatively impact performance and data integrity. It shows examples of creating a table with date, string, and number columns using implicit data type conversions and the problems this causes for indexing, statistics gathering, and query optimization. Maintaining the correct data types is important for the optimizer to choose efficient execution plans and for the database to properly enforce data constraints.
The document describes evolving execution plans in Oracle using SQL plan baselines. It shows capturing an initial plan, creating an index, capturing a new plan, and then evolving the new plan by creating an evolve task, executing it, and accepting the better plan found by the evolve process. Key steps include turning on plan capture, checking captured plans, getting execution plans, creating an index, checking for new plans, creating and running an evolve task, and accepting the recommended plan.
This document summarizes the analysis of pump failure data from three different datasets - Kirlosker, KSB, and a turbine/compressor dataset. The data is extracted from multiple excel files into R and combined. Dates are standardized and the number of days between installation and first failure is calculated for each pump. The failure notification dates are arranged in descending order for each pump and the number of days between failures is found. The analysis aims to understand pump reliability and failure patterns over time.
This is a brief introduction to how R can be useful in the manufacturing sector to calculate the frequency of faults and then developing the model so that preventive maintenance can be done
This document summarizes the implementation of a data warehousing project using SQL. It includes requirements analysis, database diagrams, and SQL scripts to create dimension and fact tables. The tables created include Vendor, Products, Inventory, Transactions, and Retailer dimensions and a Product fact table. Extract, transform, load processes are implemented using SQL Server Integration Services packages to stage and migrate data. The goal is a proof of concept for a data warehouse to track inventory, orders, and transactions.
On version 12c Oracle introduced new features to allow Adaptive optimizations: Adaptive Plans and Adaptive Statistics. After a quick presentation of concepts, this session will explore the interaction of these features with other performance management techniques using examples, like SPM and SQL profiles. Attendees will get an updated picture of tools available to troubleshoot performance issues, and how to get the most of these new features.
Oracle Data Redaction allows protecting data shown to users in real time without changing applications. It applies redaction at query execution through policies that define which data to redact for which users. Redaction occurs just before returning results and does not alter stored data. Methods include full, partial, random redaction. It introduces minimal overhead but does not prevent privileged users like DBAs from accessing raw data.
M|18 Querying Data at a Previous Point in TimeMariaDB plc
This document summarizes MariaDB System Versioning, which allows querying data at previous points in time by storing historical versions of rows. Key points:
- System Versioning adds invisible columns like row_start and row_end timestamps to track history and works with both InnoDB and MyISAM storage engines.
- Queries can select data "as of" a specific time point or between two time points. This enables use cases like point-in-time recovery, auditing past data changes, and data analysis over time.
- For InnoDB tables, history is stored transactionally using transaction IDs, allowing for true multi-version concurrency control (MVCC) semantics when querying previous versions of data
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)Valeriy Kravchuk
The recently released MariaDB 10.5 GA includes many new, useful features, but I’d like to concentrate on those helping DBAs and support engineers to find out what’s going on when a problem occurs.
Specifically I present and discuss the Performance Schema updates to match MySQL 5.7 instrumentation, new tables in the INFORMATION_SCHEMA to monitor the internals of a generic thread pool and improvements of ANALYZE for statements.
If you want ensure that sensitive data is masked when presented to the end user, you could change every single application and report ... or you could just do it in one place in the database.
The document discusses virtual indexes and columns in Oracle. Virtual indexes do not require disk space and time for creation like physical indexes. They can be used to test query execution plans without impacting the system. The document shows how to create a virtual index on the NO_FISICO column of the MOVTO_H table and use it to improve a query. It also discusses calculating statistics for a virtual index and using virtual columns to add calculated or derived columns to a table without changing the table definition.
Similar to Date data type and Globalization in Oracle (20)
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfUndress Baby
The quest for the best AI face swap solution is marked by an amalgamation of technological prowess and artistic finesse, where cutting-edge algorithms seamlessly replace faces in images or videos with striking realism. Leveraging advanced deep learning techniques, the best AI face swap tools meticulously analyze facial features, lighting conditions, and expressions to execute flawless transformations, ensuring natural-looking results that blur the line between reality and illusion, captivating users with their ingenuity and sophistication.
Web:- https://undressbaby.com/
SOCRadar's Aviation Industry Q1 Incident Report is out now!
The aviation industry has always been a prime target for cybercriminals due to its critical infrastructure and high stakes. In the first quarter of 2024, the sector faced an alarming surge in cybersecurity threats, revealing its vulnerabilities and the relentless sophistication of cyber attackers.
SOCRadar’s Aviation Industry, Quarterly Incident Report, provides an in-depth analysis of these threats, detected and examined through our extensive monitoring of hacker forums, Telegram channels, and dark web platforms.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Most important New features of Oracle 23c for DBAs and Developers. You can get more idea from my youtube channel video from https://youtu.be/XvL5WtaC20A
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Takashi Kobayashi and Hironori Washizaki, "SWEBOK Guide and Future of SE Education," First International Symposium on the Future of Software Engineering (FUSE), June 3-6, 2024, Okinawa, Japan
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
What is Master Data Management by PiLog Groupaymanquadri279
PiLog Group's Master Data Record Manager (MDRM) is a sophisticated enterprise solution designed to ensure data accuracy, consistency, and governance across various business functions. MDRM integrates advanced data management technologies to cleanse, classify, and standardize master data, thereby enhancing data quality and operational efficiency.
WhatsApp offers simple, reliable, and private messaging and calling services for free worldwide. With end-to-end encryption, your personal messages and calls are secure, ensuring only you and the recipient can access them. Enjoy voice and video calls to stay connected with loved ones or colleagues. Express yourself using stickers, GIFs, or by sharing moments on Status. WhatsApp Business enables global customer outreach, facilitating sales growth and relationship building through showcasing products and services. Stay connected effortlessly with group chats for planning outings with friends or staying updated on family conversations.
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.
2. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
3. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
4. Describe Date data type
SQL> select sysdate from dual;
SYSDATE
---------
11-FEB-17
DD-MON-RR is default format for retrieving Date data type in oracle and based on
NLS_TERRITORY.
5. Describe Date data type
Content
Century
Year
Month
Day
Hour
Minute
Second
6. Describe Date data type
SQL> create table test (c1 date);
Table created.
SQL> insert into test values(sysdate);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
C1
---------
11-FEB-17
SQL> select to_char(c1, 'cc yyyy-mm-dd hh24:mi:ss') as mydate from test;
MYDATE
----------------------
21 2017-02-11 14:07:25
7. Describe Date data type
Inserting or updating a date value in a table will implicitly use truncated month
SQL> insert into test values (sysdate);
1 row created.
SQL> insert into test values (to_date('12','mi'));
1 row created.
SQL> select to_char(c1, 'cc yyyy-mm-dd hh24:mi:ss') as mydate from test;
MYDATE
----------------------
21 2017-02-11 15:55:38
21 2017-02-01 00:12:00
8. Describe Date data type
Minimum and Maximum Date value in Oracle:
January 1, 4712 BCE ~ December 31, 9999 CE
9. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
10. Formatting Date data type
Format Mask Format Description
DD Day of the month
MON Month of the year
YY Two-digit year
YYYY Four-digit year including century
RR Two-digit year (Year 2000-compliant)
CC Two-digit century
HH Hours with AM and PM
HH24 Twenty-four-hour time
MI Minute
SS Seconds
11. Formatting Date data type
Example:
SQL> select * from test;
C1
---------
01-NOV-59
12-FEB-17
12-FEB-17
SQL> select to_char(c1, 'cc yyyy-mm-dd
hh24:mi:ss') as mydate from test;
MYDATE
----------------------
20 1959-11-01 00:00:00
21 2017-02-12 08:58:02
21 2017-02-12 08:58:11
SQL> select to_char(c1, 'cc q') as mydate
from test;
MYDA
----
20 4
21 1
21 1
12. Formatting Date data type
Standard Syntaxes:
to_char(date, [format], [nls_parameter]),
to_date(string, [format], [nls_parameter]),
13. Formatting Date data type
Date Format Masks for Days, Months, and Years:
Format Element Description Result
Year Case-sensitive spelling of year Twenty Seventeen
Mon Three-letter abbreviation of month Jun
Month Case-sensitive spelling of month June
Dy Three-letter abbreviation of day Mon
Day Case-sensitive spelling of day Monday
14. Formatting Date data type
Miscellaneous Date Format Masks:
Format Element Description Result
- / . , ? # ! Punctuation marks: 'MM.YY' 09.08
"any character
literal"
Character literals:
'"Week" W "of " Month'
Week 2 of September
TH Positional or ordinal text:
'DDth "of " Month'
12Th of September
SP Spelled out number:
'MmSP Month Yyyysp'
Nine September
Two Thousand Eight
THSP or SPTH Spelled out positional or
ordinal number: 'hh24SpTh'
Fourteenth
15. Formatting Date data type
Examples:
SQL> select c1 from test;
C1
---------
12-FEB-17
SQL> select to_char(c1,'Day "the "ddth "of" Month YYYY') as mytDate from test;
MYTDATE
--------------------------------------------------------------------------------
Sunday the 12th of February 2017
16. Formatting Date data type
What is fm?
The names of days and months are automatically padded with spaces. These may be removed using a
modifier to the format mask called the fill mode (fm) operator.
Example:
SQL> select to_char(c1,'Day "the "ddth "of" Month YYYY') as mytDate from test;
MYTDATE
--------------------------------------------------------------------------------
Sunday the 12th of February 2017
SQL> select to_char(c1,'fmDay "the "ddth "of" Month YYYY') as mytDate from test;
MYTDATE
--------------------------------------------------------------------------------
Sunday the 12th of February 2017
17. Formatting Date data type
Converting between calendars:
to_char(date, [format], [nls_parameter]),
There are two nls_parameters:
1. nls_date_language
2. nls_calendar
18. Formatting Date data type
1. nls_date_language
The NLS_DATE_LANGUAGE parameter specifies the language for the day and the month names
produced by the TO_CHAR and TO_DATE functions.
2. nls_calendar
Many different calendar systems are in use throughout the world. NLS_CALENDAR specifies which
calendar system Oracle Database uses.
19. Formatting Date data type
Examples:
SQL> select to_char(c1,'fmDay "of" fmMonth') as mydate from test;
MYDATE
----------------------------------------------------------------------------
Tuesday of March
SQL> select to_char(c1,'fmDay "of" fmMonth','nls_date_language=french') as mydate from test;
MYDATE
------------------------------------------------------------------------
Mardi of Mars
SQL> select to_char(c1,'fmDay "of" fmMonth','nls_date_language=persian') as mydate from test;
select to_char(c1,'fmDay "of" fmMonth','nls_date_language=persian') as mydate from test
*
ORA-12702: invalid NLS parameter string used in SQL function
20. Formatting Date data type
How to use Persian Calendar in Oracle ?
SQL> select to_char(c1,'ddth "of" fmMonth "of" yyyy') as mydate from test;
MYDATE
----------------------------------------------------
21st of March of 2017
SQL> select to_char(c1,'ddth "of" fmMonth "of" yyyy','nls_calendar=persian') as mydate from test;
MYDATE
------------------------------------------------------------
01st of Farvardin of 1396
SQL> select to_char(c1,'yyyy/mm/dd','nls_calendar=persian') as mydate from test;
MYDATE
----------
1396/01/01
21. Formatting Date data type
The necessity of using to_date function:
For inserting Date in Date data type columns (best practice)
Note: you could use only string formats for inserting Date data type in column based on
NLS_DATE_FORMAT parameter, otherwise use to_date function.
22. Formatting Date data type
Examples:
SQL> select * from nls_session_parameters where parameter='NLS_DATE_FORMAT';
PARAMETER VALUE
-------------------- --------------------
NLS_DATE_FORMAT DD-MON-RR
SQL> insert into test values ('1980');
insert into test values ('1980')
*
ORA-01861: literal does not match format string
SQL> alter session set nls_date_format='yyyy';
Session altered.
SQL> insert into test values ('1990');
1 row created.
23. Formatting Date data type
Examples cont’d:
SQL> select * from nls_session_parameters where parameter='NLS_DATE_FORMAT';
PARAMETER VALUE
------------------------------ --------------------
NLS_DATE_FORMAT yyyy
SQL> insert into test values (to_date('2016-aug-02','yyyy-mon-dd'));
1 row created.
SQL> insert into test values (to_date('2016','yyyy'));
1 row created.
24. Formatting Date data type
What is fx?
fx specifies an exact match for string and the format mask. When the fx modifier is specified, character items
that do not exactly match the format mask yield an error.
to_date(string, [format], [nls_parameter])
SQL> insert into test values (to_date('25-DEC-10', 'dd-mon-yyyy'));
1 row created.
SQL> insert into test values (to_date('25-DEC-10', 'fxdd-mon-yyyy'));
insert into test values (to_date('25-DEC-10', 'fxdd-mon-yyyy'))
*
ORA-01862: the numeric value does not match the length of the format item
25. Formatting Date data type
Simplifying the insertion of Persian Date:
SQL> insert into test values (to_date('1363/04/07 10:00','fxyyyy/mm/dd hh24:mi','nls_calendar=persian'));
1 row created.
SQL> select to_char(c1,'fmDay "the" ddth "of" Month yyyy') as mtdate from test;
MTDATE
--------------------------------------------------------------------------------
Thursday the 28th of June 1984
SQL> select to_char(c1,'fmDay "the" ddth "of" Month yyyy','nls_calendar=persian') as mtdate from test;
MTDATE
--------------------------------------------------------------------------------
Thursday the 7th of Tir 1363
26. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
27. Arithmetic on Date data type
Which arithmetic supported on Date data type:
Date1 – Date2 = Num1
Date1 + Num1 = Date2
Date1 = Date2 + Num1
28. Arithmetic on Date data type
Examples:
SQL> select sysdate - (sysdate + 1) as mydate from dual;
MYDATE
----------
-1
SQL> select sysdate + 1 as mydate from dual;
MYDATE
---------
14-FEB-17
As you can see, the standard unit in Oracle date arithmetic is one day.
29. Arithmetic on Date data type
Fractions of a day:
Precision Day Day Day
1 Day 1 1 1
1 Hour 1/24 1/24 0.0417
1 Min 1/(24x60) 1/1440 0.000694
1 Sec 1/(24x60x60) 1/86400 0.000011574
30. Arithmetic on Date data type
Examples:
SQL> select to_char(c1,'yyyy/mm/dd hh24:mi:ss') as mydate from test;
MYDATE
-------------------
2014/02/01 00:00:00
Add 5 minutes:
SQL> select to_char(c1 +(5/1440),'yyyy/mm/dd hh24:mi:ss') as mydate from test;
MYDATE
-------------------
2014/02/01 00:05:00
31. Arithmetic on Date data type
Examples cont’d:
The notation in the second column is most commonly used, because it is so much easier to read. Five
minutes is 5/(24x60), much easier than 5/1440 or 0.00347.
Subtracting 32 Second:
SQL> select to_char(c1-(32/(24*60*60)),'yyyy/mm/dd hh24:mi:ss') as mydate from test;
MYDATE
-------------------
2014/01/31 23:59:28
32. Arithmetic on Date data type
Oracle date arithmetic with intrinsic functions:
Date / Time Math Time Description
WHERE (date) > sysdate - 7/24; Past 7 hours
WHERE (date) > sysdate - 7; Past 7 days
WHERE (date) > sysdate - 7/1440; Past 7 minutes
13/24 13 hours
1/24/60/60 One second
5/24/60 Five minutes
5/24 Five hours
TRUNC(SYSDATE+1/24,'HH')
One hour starting with the next
hour
33. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
34. Single row functions
Some important functions:
MONTHS_BETWEEN
ADD_MONTHS
LAST_DAY
NEXT_DAY
SYSDATE
ROUND
TRUNC
35. Single row functions
MONTHS_BETWEEN:
The MONTHS_BETWEEN(date1, date2) function returns the number of months between two dates.
SQL> alter session set nls_calendar=persian;
Session altered.
SQL> select months_between('22-Bahman-1394','22-Ordibehesht-1310') as mydate from dual;
MYDATE
----------
1016.93548
36. Single row functions
ADD_MONTHS:
The ADD_MONTHS(date1, number of months) function returns the date resulting from adding a specified
number of months to a date.
SQL> select add_months('22-Bahman-1394',3) as mydate from dual;
MYDATE
-------------------
22 Ordibehesht 1395
37. Single row functions
LAST_DAY:
The LAST_DAY(date) function returns the last day of the month that the specified date falls into.
SQL> select last_day(to_date('09-Esfand-1395')) as mydate from dual;
MYDATE
-------------------
30 Esfand 1395
SQL> select last_day(to_date('09-Esfand-1394')) as mydate from dual;
MYDATE
-------------------
29 Esfand 1394
38. Single row functions
NEXT_DAY:
The NEXT_DAY(date1, day of the week) function returns the date on which the next specified day of the
week falls after the given date.
SQL> select to_char(to_date('09-Esfand-1395'),'fmDay "the" rr/mm/dd') as mydate from dual;
MYDATE
------------------
Monday the 95/12/9
SQL> select to_char(next_day('09-Esfand-1395','Friday'),'fmDay "the" rr/mm/dd') as mydate from dual;
MYDATE
-------------------
Friday the 95/12/13
39. Single row functions
SYSDATE:
The SYSDATE function takes no parameters and returns a date value that represents the current server
date and time.
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as mydate from dual;
MYDATE
-------------------
1395/11/26 10:38:24
40. Single row functions
ROUND:
The ROUND(date, date precision format) function round a given date value to the nearest date precision
format like day, month, or year.
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as currdate, to_char(round(sysdate,'mm'),'yyyy/m
m/dd hh24:mi:ss') as mydate from dual;
CURRDATE MYDATE
------------------- -------------------
2017/02/14 10:52:59 2017/02/01 00:00:00
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as currdate, to_char(round(sysdate,'hh'),'yyyy/m
m/dd hh24:mi:ss') as mydate from dual;
CURRDATE MYDATE
------------------- -------------------
2017/02/14 10:53:28 2017/02/14 11:00:00
41. Single row functions
TRUNC:
The TRUNC(date, date precision format) truncate a given date value to the nearest date precision format
like day, month, or year.
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as currdate, to_char(trunc(sysdate,'mm'),'yyyy/m
m/dd hh24:mi:ss') as mydate from dual;
CURRDATE MYDATE
------------------- -------------------
2017/02/14 10:57:49 2017/02/01 00:00:00
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as currdate, to_char(trunc(sysdate,'hh'),'yyyy/mm
/dd hh24:mi:ss') as mydate from dual;
CURRDATE MYDATE
------------------- -------------------
2017/02/14 10:58:07 2017/02/14 10:00:00
42. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
43. Oracle Globalization
NLS Parameters:
NLS (National Language Support) parameters determine the locale-specific behavior on both the client
and the server. NLS parameters can be specified in the following ways:
• As initialization parameters on the server
• As environment variables on the client
• With the ALTER SESSION statement
• In SQL functions
44. Oracle Globalization
As initialization parameters on the server
You can include parameters in the initialization parameter file to specify a default session NLS
environment. These settings have no effect on the client side; they control only the server's behavior.
For example:
NLS_TERRITORY = "CZECH REPUBLIC"
45. Oracle Globalization
As environment variables on the client
You can use NLS environment variables, which may be platform-dependent, to specify locale-dependent
behavior for the client and also to override the default values set for the session in the initialization param
eter file. For example:
Linux system:
export NLS_DATE_FORMAT="Day yyyy"
Windows system:
set NLS_DATE_FORMAT=yyyy/mm/dd hh24:mi:ss
46. Oracle Globalization
With the ALTER SESSION statement:
You can use NLS parameters that are set in an ALTER SESSION statement to override the default
values that are set for the session in the initialization parameter file or set by the client with environment
variables.
ALTER SESSION SET NLS_SORT = AZERBAIJANI;
47. Oracle Globalization
In SQL functions:
You can use NLS parameters explicitly to hardcode NLS behavior within a SQL function. This practice
overrides the default values that are set for the session in the initialization parameter file, client with
environment variables and ALTER SESSION statement.
For example:
TO_CHAR(hiredate, 'DD/MON/YYYY', ' nls_calendar=persian ')
48. Oracle Globalization
Setting NLS Parameters and Their Priorities:
Priority Method
1 (highest) Explicitly set in SQL functions
2 Set by an ALTER SESSION statement
3 Set as an environment variable
4 Specified in the initialization parameter file
5 Default
49. Oracle Globalization
Views to find current NLS settings:
• nls_database_parameters
• nls_instance_parameters
• nls_session_parameters
Note: NLS_CHARACTERSET, NLS_NCHAR_CHARACTERSET and NLS_RDBMS_VERSION, there
are only exist in the nls_database_parameter.
50. Oracle Globalization
Find all valid CHARACTER SET,TERRITORY,LANGUAGE:
Simply with v$nls_valid_values
Example:
SQL> select * from v$nls_valid_values where lower(parameter) ='territory';
PARAMETER VALUE ISDEP
-------------------- ------------------------------ -------------
TERRITORY ECUADOR FALSE
TERRITORY PHILIPPINES FALSE
TERRITORY ALBANIA FALSE
98 rows selected.
51. Oracle Globalization
Some important NLS parameters:
• NLS_TERRITORY
• NLS_DATE_FORMAT
• NLS_LANGUAGE (mentioned in section two)
• NLS_CALENDER (mentioned in section two)
52. Oracle Globalization
NLS_TERRITORY:
The territory selection sets defaults for day and week numbering, credit and debit symbols, date formats,
decimal and group numeric separators, and currency symbols. Some of these can have profound effects
on the way your application software will behave.
Parameters American Germany
NLS_TERRITORY american germany
Decimal separator , .
Currency symbol $ €
First day of week Sunday Monday
53. Oracle Globalization
NLS_TERRITORY:
Example:
alter session set NLS_TERRITORY='germany';
select to_char(8527,'L999G999') as myChar from dual;
€8.527
alter session set NLS_TERRITORY='america';
select to_char(8527,'L999G999') as myChar from dual;
$8,527
54. Oracle Globalization
NLS_DATE_FORMAT:
The NLS_DATE_FORMAT parameter defines the default date format to use with the TO_CHAR and
TO_DATE functions. The NLS_TERRITORY parameter determines the default value of
NLS_DATE_FORMAT. The value of NLS_DATE_FORMAT can be any valid date format
mask. For example: NLS_DATE_FORMAT = "MM/DD/YYYY“
Country Description Example
Estonia dd.mm.yyyy 28.02.2003
Germany dd-mm-rr 28-02-03
Japan rr-mm-dd 03-02-28
UK dd-mon-rr 28-Feb-03
US dd-mon-rr 28-Feb-03
55. Agenda
• Describe Date data type
• Formatting Date data type
• Arithmetic on Date data type
• Single row functions
• Oracle Globalization
• Date consideration in flashback
56. Date consideration in flashback
What is Flashback Technology ?
Oracle Flashback Technology is a group of Oracle Database features that let you view past states of data
base objects or to return database objects to a previous state without using point-in-time media recovery.
Oracle Flashback features use the Automatic Undo Management (AUM) system to obtain metadata and
historical data for transactions. They rely on undo data, which are records of the effects of individual tran
sactions. For example, if a user runs an UPDATE statement to change a salary from 1000 to 1100, then
Oracle Database stores the value 1000 in the undo data.
57. Date consideration in flashback
Using Oracle Flashback Query (SELECT AS OF)
To use Oracle Flashback Query, use a SELECT statement with an AS OF clause. Oracle Flashback
Query retrieves data as it existed at an earlier time. The query explicitly references a past time through a
time stamp or System Change Number (SCN). It returns committed data that was current at that point in
time.
Uses of Oracle Flashback Query include:
• Recovering lost data or undoing incorrect, committed changes.
For example, if you mistakenly delete or update rows, and then commit them, you can immediately undo
the mistake.
• Comparing current data with the corresponding data at an earlier time.
For example, you can run a daily report that shows the change in data from yesterday. You can compare
individual rows of table data or find intersections or unions of sets of rows.
58. Date consideration in flashback
Flashback Example:
SQL> select * from countries where country_name='Iran';
no rows selected
SQL> select to_char(sysdate,'rr/mm/dd hh24:mi:ss') as currdate from dual;
CURRDATE
-----------------
17/02/15 15:27:07
SQL> insert into countries values('IR','Iran',4);
1 row created.
59. Date consideration in flashback
Flashback Example cont’d:
SQL> select to_char(sysdate,'rr/mm/dd hh24:mi:ss') as currdate from dual;
CURRDATE
-----------------
17/02/15 15:28:29
SQL> select * from countries where country_name='Iran';
CO COUNTRY_NAME REGION_ID
-- ---------------------------------------- ----------
IR Iran 4
60. Date consideration in flashback
Flashback Example cont’d:
SQL> select * from countries as of timestamp to_timestamp('17/02/15 15:27:07','rr/mm/dd hh24:mi:ss')
where country_name='Iran';
no rows selected
flashback table countries to timestamp to_timestamp('17/02/15 15:27:07','rr/mm/dd hh24:mi:ss');
Flashback succeeded.
SQL> select * from countries where country_name='Iran';
no rows selected
61. Date consideration in flashback
Relative time:
If you specify a relative time by subtracting from the current time on the database host, the past time is re
calculated for each query. For example:
SQL> insert into countries values ('PO','Poland',1);
1 row created.
SQL> select * from countries As of timestamp (systimestamp - interval '1' minute) where country_name='
Poland';
CO COUNTRY_NAME REGION_ID
-- ---------------------------------------- ----------
PO Poland 1
62. Date consideration in flashback
Arguments which could be passed to relevant flashback:
select * from countries As of timestamp (systimestamp - interval '1' <argument>);
Arguments
Year
Month
Day
Hour
Minute
Second
63. Date consideration in flashback
Relative or Exact ?
Exact example:
select * from countries As of timestamp to_timestamp('17/02/18 10:49:12', 'rr/mm/dd hh24:mi:ss');
Relative example:
select * from countries As of timestamp (systimestamp - interval '1' minute);
Method Simplicity Accuracy
Exact No Yes
Relative Yes No