This document discusses best practices for PL/SQL including avoiding hard coding, row-by-row processing, and memory management. It recommends using SQL as a service, bulk processing, bulk collect with limit clause, and NOCOPY hint for memory. It also discusses data caching techniques like deterministic functions, PGA caching, and function result cache to improve performance.
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingSteven Feuerstein
Is your Oracle Database application running slower than you'd like? One of the first things to check is row-by-row processing: non-query DML (insert, update, delete) within a loop. And the fix? Bulk processing, either with smarter SQL or with FORALL and BULK COLLECT in PL/SQL.
Oracle Text is a facility within the database that provides more advanced indexing & search techniques - including the ability to index documents stored in your database; on your server; or even the web!
Now you can incorporate this functionality into your web application using Oracle Application Express.
This presentation will demonstrate how easy it is to combine the two, and give you a platform for further expansion and exploration within a very powerful product.
Every day, in one way or another, we come in contact with computer applications. • If you checked your email today, it was probably done using an application. • If you bought an item at a grocery store, the clerk scanned the item using an application that calculated your bill and updated the store inventory.
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingSteven Feuerstein
Is your Oracle Database application running slower than you'd like? One of the first things to check is row-by-row processing: non-query DML (insert, update, delete) within a loop. And the fix? Bulk processing, either with smarter SQL or with FORALL and BULK COLLECT in PL/SQL.
Oracle Text is a facility within the database that provides more advanced indexing & search techniques - including the ability to index documents stored in your database; on your server; or even the web!
Now you can incorporate this functionality into your web application using Oracle Application Express.
This presentation will demonstrate how easy it is to combine the two, and give you a platform for further expansion and exploration within a very powerful product.
Every day, in one way or another, we come in contact with computer applications. • If you checked your email today, it was probably done using an application. • If you bought an item at a grocery store, the clerk scanned the item using an application that calculated your bill and updated the store inventory.
Woo hoo!
18c Qualified expressions for collections and records
Whitelisting with the ACCESSIBLE_BY Clause
More PL/SQL-Only Data Types Cross PL/SQL-to-SQL Interface
Optimizing Function Execution in SQL
The UTL_CALL_STACK Package
Privileges/Access Management for Program Units
Static Expressions In Place of Literals
Marking elements for deprecation
PL/Scope now includes SQL statements in its analysis
ORACLE PERFORMANCE TUNNING
1 – 1: Introduction to Oracle tuning
- The top-down approach to tuning
- The history of Oracle tuning
- A review of the Oracle architecture
- The goals of Oracle tuning
- Overview of SQL tuning
- Oracle network bottlenecks
- Oracle RAM usage and bottlenecks
- Oracle CPU usage and bottlenecks
- Oracle disk I/O overview
- Monitoring server (sat, vmstat, top, glance)
- Movement toward server consolidation
1 – 2: Oracle disk I/O tuning
- History of DASD
- Understanding disk I/O
- Monitoring disk I/O (AWR, dba_hist_filestatxs)
- Sorted hash cluster tables
- Disk I/O waits
- Oracle data buffer internals (db_cache_size)
- Caching data blocks in the PGA (parallel full-table scans)
- Blocksize and I/O performance
1 – 3: Oracle CPU Tuning
- Finding your cpu_count
- Measuring CPU usage with vmstat
- Oracle CPU usage
- Using processor affinity
- _optimizer_cost_model=cpu
- Parallel query and CPU
It consists of important different concepts related to PL/SQL that are covered like the Basic structure of PL/SQL block, Variables and Constants in PL/SQL, Control Structures i.e., Conditional, Iterative, and Sequential Control, Procedure and Function, Cursors and its Types, Applications of implicit and explicit cursors, Triggers and its Types and Exception Handling.
SQL Server site utilization
Talk about “A5:SQL Mk-2”
* SQL development tools commonly used in SQL Server
* What is "A5:SQL Mk-2"?
* Features
* Demo
* Conclusion
SemaRule Navigator: An Open-Source Framework for Semantic and Text Analysis A...SemaRule
Wouldn't it be nice if they all played together nicely? You know... Jena, Lucene, HermiT, Joseki, Pellet, Python, JavaScript, BeanShell, Prolog, OWL API, SPARQL, SWRL... your stuff... the whole gang. SemaRule Navigator leads the way and it's Open Source!
Woo hoo!
18c Qualified expressions for collections and records
Whitelisting with the ACCESSIBLE_BY Clause
More PL/SQL-Only Data Types Cross PL/SQL-to-SQL Interface
Optimizing Function Execution in SQL
The UTL_CALL_STACK Package
Privileges/Access Management for Program Units
Static Expressions In Place of Literals
Marking elements for deprecation
PL/Scope now includes SQL statements in its analysis
ORACLE PERFORMANCE TUNNING
1 – 1: Introduction to Oracle tuning
- The top-down approach to tuning
- The history of Oracle tuning
- A review of the Oracle architecture
- The goals of Oracle tuning
- Overview of SQL tuning
- Oracle network bottlenecks
- Oracle RAM usage and bottlenecks
- Oracle CPU usage and bottlenecks
- Oracle disk I/O overview
- Monitoring server (sat, vmstat, top, glance)
- Movement toward server consolidation
1 – 2: Oracle disk I/O tuning
- History of DASD
- Understanding disk I/O
- Monitoring disk I/O (AWR, dba_hist_filestatxs)
- Sorted hash cluster tables
- Disk I/O waits
- Oracle data buffer internals (db_cache_size)
- Caching data blocks in the PGA (parallel full-table scans)
- Blocksize and I/O performance
1 – 3: Oracle CPU Tuning
- Finding your cpu_count
- Measuring CPU usage with vmstat
- Oracle CPU usage
- Using processor affinity
- _optimizer_cost_model=cpu
- Parallel query and CPU
It consists of important different concepts related to PL/SQL that are covered like the Basic structure of PL/SQL block, Variables and Constants in PL/SQL, Control Structures i.e., Conditional, Iterative, and Sequential Control, Procedure and Function, Cursors and its Types, Applications of implicit and explicit cursors, Triggers and its Types and Exception Handling.
SQL Server site utilization
Talk about “A5:SQL Mk-2”
* SQL development tools commonly used in SQL Server
* What is "A5:SQL Mk-2"?
* Features
* Demo
* Conclusion
SemaRule Navigator: An Open-Source Framework for Semantic and Text Analysis A...SemaRule
Wouldn't it be nice if they all played together nicely? You know... Jena, Lucene, HermiT, Joseki, Pellet, Python, JavaScript, BeanShell, Prolog, OWL API, SPARQL, SWRL... your stuff... the whole gang. SemaRule Navigator leads the way and it's Open Source!
Xenogenetics for PL/SQL - infusing with Java best practicesLucas Jellema
Xenogenetics for PL/SQL- Infusing with Java Best Practices and Design Patterns - PL/SQL is a venerable programming language that is both vital and very much alive. This session will discuss how we further rejuvenate and enhance the way we create PL/SQL programs. We'll tap into the world of .NET, Java, and other modern programming language to do some cherry picking: what are the very best practices, concepts, and design patterns and how can we apply them to PL/SQL? We'll explain and demonstrate dependency injection, the observer pattern based on listeners, aspect-oriented programming (AOP), the decorator and template pattern, use of user-defined nested types, and collections.
During this Big Data Warehousing Meetup, Caserta Concepts and Databricks addressed the number one operational and analytic goal of nearly every organization today – to have complete view of every customer. Customer Data Integration (CDI) must be implemented to cleanse and match customer identities within and across various data systems. CDI has been a long-standing data engineering challenge, not just one of logic and complexity but also of performance and scalability.
The speakers brought together best practice techniques with Apache Spark to achieve complete CDI.
Speakers:
Joe Caserta, President, Caserta Concepts
Kevin Rasmussen, Big Data Engineer, Caserta Concepts
Vida Ha, Lead Solutions Engineer, Databricks
The sessions covered a series of problems that are adequately solved with Apache Spark, as well as those that are require additional technologies to implement correctly. Topics included:
· Building an end-to-end CDI pipeline in Apache Spark
· What works, what doesn’t, and how do we use Spark we evolve
· Innovation with Spark including methods for customer matching from statistical patterns, geolocation, and behavior
· Using Pyspark and Python’s rich module ecosystem for data cleansing and standardization matching
· Using GraphX for matching and scalable clustering
· Analyzing large data files with Spark
· Using Spark for ETL on large datasets
· Applying Machine Learning & Data Science to large datasets
· Connecting BI/Visualization tools to Apache Spark to analyze large datasets internally
The speakers also touched on data governance, on-boarding new data rapidly, how to balance rapid agility and time to market with critical decision support and customer interaction. They also shared examples of problems that Apache Spark is not optimized for.
For more information on the services offered by Caserta Concepts, visit our website: http://casertaconcepts.com/
Understanding, Planning and Achieving
Data Quality in Your Organization
by Joe Caserta, President of Caserta Concepts
For more information, visit www.casertaconcepts.com or contact us at info@casertaconcepts.com
Joe Caserta's 2016 Data Summit Workshop "Introduction to Data Science with Hadoop" on May 9, expanded on his Intro to Data Science Workshop held at last year's Summit. Again, Joe presented to a standing-room only audience with a focus on the data lake, governance and the role of the data scientist.
For more information on Caserta Concepts, visit our website: http://casertaconcepts.com/
Building a New Platform for Customer Analytics Caserta
Caserta Concepts and Databricks partner up to bring you this insightful webinar on how a business can choose from all of the emerging big data technologies to figure out which one best fits their needs.
Caserta Concepts, Datameer and Microsoft shared their combined knowledge and a use case on big data, the cloud and deep analytics. Attendes learned how a global leader in the test, measurement and control systems market reduced their big data implementations from 18 months to just a few.
Speakers shared how to provide a business user-friendly, self-service environment for data discovery and analytics, and focus on how to extend and optimize Hadoop based analytics, highlighting the advantages and practical applications of deploying on the cloud for enhanced performance, scalability and lower TCO.
Agenda included:
- Pizza and Networking
- Joe Caserta, President, Caserta Concepts - Why are we here?
- Nikhil Kumar, Sr. Solutions Engineer, Datameer - Solution use cases and technical demonstration
- Stefan Groschupf, CEO & Chairman, Datameer - The evolving Hadoop-based analytics trends and the role of cloud computing
- James Serra, Data Platform Solution Architect, Microsoft, Benefits of the Azure Cloud Service
- Q&A, Networking
For more information on Caserta Concepts, visit our website: http://casertaconcepts.com/
Agile Data Warehouse Design for Big Data PresentationVishal Kumar
Synopsis:
[Video link: http://www.youtube.com/watch?v=ZNrTxSU5IQ0 ]
Jim Stagnitto and John DiPietro of consulting firm a2c) will discuss Agile Data Warehouse Design - a step-by-step method for data warehousing / business intelligence (DW/BI) professionals to better collect and translate business intelligence requirements into successful dimensional data warehouse designs.
The method utilizes BEAM✲ (Business Event Analysis and Modeling) - an agile approach to dimensional data modeling that can be used throughout analysis and design to improve productivity and communication between DW designers and BI stakeholders. BEAM✲ builds upon the body of mature "best practice" dimensional DW design techniques, and collects "just enough" non-technical business process information from BI stakeholders to allow the modeler to slot their business needs directly and simply into proven DW design patterns.
BEAM✲ encourages DW/BI designers to move away from the keyboard and their entity relationship modeling tools and begin "white board" modeling interactively with BI stakeholders. With the right guidance, BI stakeholders can and should model their own BI data requirements, so that they can fully understand and govern what they will be able to report on and analyze.
The BEAM✲ method is fully described in
Agile Data Warehouse Design - a text co-written by Lawrence Corr and Jim Stagnitto.
About the speaker:
Jim Stagnitto Director of a2c Data Services Practice
Data Warehouse Architect: specializing in powerful designs that extract the maximum business benefit from Intelligence and Insight investments.
Master Data Management (MDM) and Customer Data Integration (CDI) strategist and architect.
Data Warehousing, Data Quality, and Data Integration thought-leader: co-author with Lawrence Corr of "Agile Data Warehouse Design", guest author of Ralph Kimball’s “Data Warehouse Designer” column, and contributing author to Ralph and Joe Caserta's latest book: “The DW ETL Toolkit”.
John DiPietro Chief Technology Officer at A2C IT Consulting
John DiPietro is the Chief Technology Officer for a2c. Mr. DiPietro is responsible
for setting the vision, strategy, delivery, and methodologies for a2c’s Solution
Practice Offerings for all national accounts. The a2c CTO brings with him an
expansive depth and breadth of specialized skills in his field.
Sponsor Note:
Thanks to:
Microsoft NERD for providing awesome venue for the event.
http://A2C.com IT Consulting for providing the food/drinks.
http://Cognizeus.com for providing book to give away as raffle.
The Amazing and Elegant PL/SQL Function Result CacheSteven Feuerstein
The Function Result Cache, introduced in Oracle Database 11g, offers a very elegant way to cache cross-session data and make it available via PL/SQL functions. It can have a dramatic performance impact on fetching static data (even static for just a period of time) - and it's managed automatically by Oracle Database for you!
MySql's NoSQL -- best of both worlds on the same disksDave Stokes
Get the best of both worlds -- SQL access and NoSQL access to the same data using the Memcached protocol. 9x faster than regular SQL, the Memcached protocol use allows applications to drink from the fire hose. Plus now your cache can be stored permanently. Easy and simple to implement.
Zero Downtime for Oracle E-Business Suite on Oracle ExalogicPaulo Fagundes
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
Presenter manual oracle dba (specially for summer interns)XPERT INFOTECH
XPERT INFOTECH imparts qualitative training in .NET, ASP.NET, PHP, PHP++, JAVA, J2EE, ORACLE DBA, ORALE D2K, RIA, SEO, WEB DEVELOPMENT, MOBILE APPLICATIONS DEVELOPMENT, ANDROID and other latest technologies. The training is designed for the BCA/MCA/B.E./B-Tech students who want to speed up their technical skills and proficiencies into real time development environment.
This presentation describes the Oracle Database In-Memory Advisor, which is an easy tool to evaluate the benefit of 12c In-Memory Option in your environment. It also provides you with recommendations on the optimal configuration of Oracle Database In-Memory.
Webinář "Konsolidace Oracle DB na systémech s procesory M7, včetně migrace z konkurenčních serverových platforem"
Prezentuje Josef Šlahůnek, Oracle
9.3.2016
Oracle ACE Director Dan Morgan presented those slides about migrating to database 12c and how to get it right. For more information, visit www.perftuning.com
Between 2015 and 2017 a large percentage of Oracle's existing customer base will be upgrading their existing databases to the new version 12cR1. Most of the time when upgrades happen the only benefits organizations receive are the satisfaction of having survived the upgrade unscathed. In general, the new database, other than having a new version number, provides little in the way of tangible benefits.
With the re-architecture that can come with a 12cR1 upgrade it is, for the first time, possible to plan for and receive substantial measurable benefits, and possible to make costly mistakes that could create substantial liabilities that are both business and financial.
Oracle ACE Director and industry veteran Dan Morgan, in a presentation targeted to IT/IS management explores both the benefits and the risks and provide a guideline for "getting it right."
This Performance Tuning's Lunch & Learn event focuses on management, planning, and budgeting, not features and technology, and provides you and your management teams the information they need to perform the next database upgrade or migration cycle.
View the companion webinar at: http://embt.co/1xcLFjJ
If you’ve ever wanted to code or understand more about PL/SQL code, this 2-part series is for you.
Join Oracle ACE Director, Dan Hotka and Solutions Consultant Director, Scott Walz as they present and demo the fundamentals of PL/SQL and much more.
Watch the webinar to learn about:
+ PL/SQL variable types and naming convention
+ How to code PL-SQL
+ When to use IF-THEN-ELSE or CASE
+ Profiling and debugging PL/SQL
Techniques to optimize the pagerank algorithm usually fall in two categories. One is to try reducing the work per iteration, and the other is to try reducing the number of iterations. These goals are often at odds with one another. Skipping computation on vertices which have already converged has the potential to save iteration time. Skipping in-identical vertices, with the same in-links, helps reduce duplicate computations and thus could help reduce iteration time. Road networks often have chains which can be short-circuited before pagerank computation to improve performance. Final ranks of chain nodes can be easily calculated. This could reduce both the iteration time, and the number of iterations. If a graph has no dangling nodes, pagerank of each strongly connected component can be computed in topological order. This could help reduce the iteration time, no. of iterations, and also enable multi-iteration concurrency in pagerank computation. The combination of all of the above methods is the STICD algorithm. [sticd] For dynamic graphs, unchanged components whose ranks are unaffected can be skipped altogether.
As Europe's leading economic powerhouse and the fourth-largest hashtag#economy globally, Germany stands at the forefront of innovation and industrial might. Renowned for its precision engineering and high-tech sectors, Germany's economic structure is heavily supported by a robust service industry, accounting for approximately 68% of its GDP. This economic clout and strategic geopolitical stance position Germany as a focal point in the global cyber threat landscape.
In the face of escalating global tensions, particularly those emanating from geopolitical disputes with nations like hashtag#Russia and hashtag#China, hashtag#Germany has witnessed a significant uptick in targeted cyber operations. Our analysis indicates a marked increase in hashtag#cyberattack sophistication aimed at critical infrastructure and key industrial sectors. These attacks range from ransomware campaigns to hashtag#AdvancedPersistentThreats (hashtag#APTs), threatening national security and business integrity.
🔑 Key findings include:
🔍 Increased frequency and complexity of cyber threats.
🔍 Escalation of state-sponsored and criminally motivated cyber operations.
🔍 Active dark web exchanges of malicious tools and tactics.
Our comprehensive report delves into these challenges, using a blend of open-source and proprietary data collection techniques. By monitoring activity on critical networks and analyzing attack patterns, our team provides a detailed overview of the threats facing German entities.
This report aims to equip stakeholders across public and private sectors with the knowledge to enhance their defensive strategies, reduce exposure to cyber risks, and reinforce Germany's resilience against cyber threats.
Adjusting primitives for graph : SHORT REPORT / NOTESSubhajit Sahu
Graph algorithms, like PageRank Compressed Sparse Row (CSR) is an adjacency-list based graph representation that is
Multiply with different modes (map)
1. Performance of sequential execution based vs OpenMP based vector multiply.
2. Comparing various launch configs for CUDA based vector multiply.
Sum with different storage types (reduce)
1. Performance of vector element sum using float vs bfloat16 as the storage type.
Sum with different modes (reduce)
1. Performance of sequential execution based vs OpenMP based vector element sum.
2. Performance of memcpy vs in-place based CUDA based vector element sum.
3. Comparing various launch configs for CUDA based vector element sum (memcpy).
4. Comparing various launch configs for CUDA based vector element sum (in-place).
Sum with in-place strategies of CUDA mode (reduce)
1. Comparing various launch configs for CUDA based vector element sum (in-place).
Explore our comprehensive data analysis project presentation on predicting product ad campaign performance. Learn how data-driven insights can optimize your marketing strategies and enhance campaign effectiveness. Perfect for professionals and students looking to understand the power of data analysis in advertising. for more details visit: https://bostoninstituteofanalytics.org/data-science-and-artificial-intelligence/
2. Emrah METE
- Yıldız Teknik Üniversitesi – Bilgisayar Mühendisliği
- İş Deneyimi
- Software Developement Specialist @Turkcell Teknoloji
- Senior BI Consultant @i2i-Systems
- Senior BI Specialist @HititCs
- Senior ETL Developer @Turkcell Teknoloji
- Teknik Uzmanlık
- 5+ Oracle SQL, Oracle PL/SQL, ETL, DWH, BI
- Kurucu Üye ve Yönetim Kurulu Üyesi @TROUG
- Moderatör @OracleTurk
- Blogger
- https://emrahmete.wordpress.com/ (Türkçe)
- https://emrahmeteen.wordpress.com/ (İngilizce)
- Oracle Certified SQL Expert
- Oracle Database Developer Choice Awards 2015, SQL Category Winner!!!
- Oracle ACE
https://emrahmete.wordpress.com/about/
7. SOLUTION: SQL AS A SERVICE
APPLICATION
DATA LAYER
T3 T3 T3 T3 T3
APPLICATION
DATA LAYER
T3
OPTIMIZE MAINTAIN DEBUG WRITE CODE
FASTER
Fix Bugs
Faster
REUSED
CODE
19. - PACKAGE LEVEL PARAMETERS
- BULK COLLECT WITH LIMIT CLAUSE
- BULK COLLECT WITH VARRAYS
- USING PARALLEL PIPELINED FUNCTIONS
- USING NOCOPY HINT
MEMORY MANAGEMENT
20. USING NOCOPY
- IN => pass by reference
- OUT, IN OUT => default pass by value
- NOCOPY => pass by reference
+ Memory Consumption
+ Improve Performance
- Do not trust (in Exception State)
22. - Great technique for improving application performance
- SGA is an huge and sophisticted for the database instance.
- Also We have three other caches that we can use in PL/SQL code
- Deterministic Functions
- PGA Caching
- Function Result Cache
DATA CACHING
23. - PL/SQL Functions declared as Deterministic
- Caching using PGA
- Used most effectively with collections
- Accessing PGA more efficient than SGA
- Function Result Cache (Oracle DB 11g)
DATA CACHING
PL/SQL kodu yazarken sık kullandığımız değişken tanımlama metodu varchar2(N) şeklindedir. Bu şekilde değişken tanımlamanın belirli handikapları vardır ve bu handikaplar gün sonunda kodumuzun canlı ortamda hata almasına sebebiyet verebilmektedir.
Örneğin PL/SQL kodumuzda X tablosundaki isim kolonunu bir değişkende tutup daha sonra kullanalım.
İsim kolonumuzun veri tabanındaki tanımı varchar2(25) şeklinde olsun;
Yazdığım PL/SQL kodunda da bu alanı hard coded bir şekilde varchar2(25) olarak kod bloğumu yazdığım durumda, X tablosundaki isim kolonun veri tipi/boyutu değişmediği sürece yazdığım kod parçası doğru çalışmaya devam edecek ancak ne zaman bu tablodaki bu kolonumun veri tipini/veri boyutunu değiştirdiğimde yazdığım PL/SQL kod bloğu çalışma zamanı hataları alacak.
Bu hatayı gidermek istediğimde ise başka bir problem ile karşılaşacağım. İlgili alanı bu şekilde hard coded tanımladığım envanterimdeki tüm PL/SQL kodları içerisinde arayıp tek tek manuel değiştirmek zorundayım. Buda oldukça maliyetli bir işlem. Bu durumu engellemenin yolu ise bu şekilde değişken kullanımlarına ihtiyaç duyduğum her yerde %TYPE operatörü kullanarak alanların veri tipi veya veri boyutlarının değişme risklerine karşı PL/SQL kodlarımızın hata almasının önünde geçmek olmalı.
Dorğudan bir kolonu adreslemeyen değişen ihtiyaçlarımız için ise paket seviyesinde SUBTYPE yaratıp ilerlemek yine PL/SQL kodlarımızın veri tipi kaynaklı hata almalarını minimize edecektir.
PL/SQL kodları içine bir işi gerçekleştiren kural veya formülü doğrudan yazmak sıkça yapılan hatalar arasında.
Bu tarz formüllerin ihtiyaç duyulan her yerde hard coded bir şekilde yazılması hatalı formüllerin veya iş kurallarının üretilmesine neden olabilir.
Buna ek olarak formülde yapılacak bir değişiklik durumunda bu formülün hard coded yazıldığı her yerde tek tek manuel bulunup değiştirilmesi gerekmekte. Bu iş hem çok maliyetli hemde doğru bir şekilde arama işlemenin yapılmadığı durumda yanlış çalışan kod paraçaları anlamına gelecektir. Bu ve benzeri hataların önüne geçmek için sık kullanılan formülleri veya iş kurallarını ortak bir paket içerisinde farkılı procedure veya fonksiyonlar ile gerçekeleyip, kullanılması gereken yerlerde bu fonksiyon veya prosedürleri çağırarak kullanmak daha doğru ve hatalardan uzak bir kullanım şekli olacaktır. Böylelikle formülde yada iş kuralında bir değişiklik gerektiğinde sadece ilgili fonksiyon veya prosedürü değiştirerek iş tek bir değişiklik ile hatası tamamlanabilir.
PL/SQL kod blokları yazılırken en sık yapılan kullanım hatalarından biride kod bloğu içinde çok sık hard coded SQL cümleleri yazmak. Kod bloklarında hard coded SQL yazmak çeşitli zorlukları’da beraberinde getirecektir. Bunlar;
Optimize: İlgili SQL cümlesi iyileştirilmek edilmek istendiğinde, ilgili cümlenin geçtiği tüm kodlardaki etkinin doğru bir şekilde incelenip ona göre optimizasyon işleminin yapılması gerekmekte. Bu durum bu işlemin çok uzamasına ve zorlaşmasına neden olabilir.
Maintain: İlgil SQL’de yapılacak herhangi bir değişikliğin kullanıldığı heryerde yapılması gerekmekte. Bu bağlamda kodun bakımı oldukça zorlaşacak.
Debug: Debug yapılmak istendiğinde kodun yazıldığı heryerde debug işleminin yapılması gerekmekte.
Hardcoded SQL yazımının yarattığı handikapların önüne geçmek için, şekildeki gibi bir yaklaşım uygulanarak SQL cümleleri, yazılan PL/SQL kodlarında bir servis şeklinde çağırılmalıdır. Bu yöntem ile çağıralacak SQL kodları merkezi bir paket içerisinde fonksiyon veya prosedür yazılarak, ihtiyaç duyulan yerlerde çağırılması sağlanarak belirli avantajlar sağlanacaktır. Bunlar;
Kodun Optimzasyonunun daha kolay ve hızlı yapılması. ,
Kodun bakımının kolaylaşması.,
Olası bir değişikliğin Debug edilmesinin kolaylaşarak hızlanması,
Kod tek bir yerde yazılacağı için daha hızlı kod geliştirilmesi,
Bug onarımlarının tek bir yerden daha hızlı yapılması,
Bir kez yazılan kodun tekrar tekrar kullanılması,
Örnek bir SQL servisi. Bu servis ile EMPLOYEES tablosuna insert, update ve delete gibi sık yapılması muhtemel DML operasyonlarının kodları yazılarak bir servis haline getirilmiştir.
PL/SQL kod bloklarında en sık kullandığımız yapılardan biride CURSOR ile bir veri gurubunu alıp satır satır işleme tabii tutmak.
İlk bakışta bir performans problemi yokmuş gibi gözükse de bu durumun performansı negatif etkileyen önemli etkileri vardır.
Bu etkiyi daha ayrıntılı açıklayabilmek adına ilk etapta bu mekanizmanın nasıl çalıştığını anlamak faydalı olacaktır.
Oracle veritabanı kodlarımızı execute edebilmek için iki farklı engine sahip. Bunlar;
PL/SQL Runtine Engine
SQL Engine
Yazdığımız PL/SQL kod bloklarında kodumuzun PL/SQL ile ilgili kısımları «PL/SQL Runtine Engine»’de SQL ile ilgili kısımları «SQL Engine»’de execute edilmekte ancak bu iş birbirinden bağımsız gerçekleşmemekte.
Örneğin bir döngü içerisinde yapılan bir update işleminde döngü ile ilgili işlemler PL/SQL Runtime Engine içerisinde hesaplanıp, döngünün içerisindeki update cümlesine ilgili parametre geçirilip yeni bir SQL oluşturulmakta. Daha sonra bu oluşan SQL, SQL Engine gönderilip execute edilmesi sağlanıyor. (PL/SQL Runtime Engine ile SQL Engine arasındaki geçişlere Context Switching adı verilmekte. ) Bu işlem sonrasında bir sonuç oluşuyorsa, ilgili sonuç PL/SQL Runtime Engine geri döndürülüyor ve döngü bir sonraki iterasyon ile devam ediyor. Döngü sonlanana kadar bu işlem sırası ile gerçekleştiriliyor.
Bu işlemler esnasında her adımda bir Context Switching söz konusu. Context her iki engine arasında her değiştiğinde belirli bir miktar süre kaybediliyor yapılan geçiş sebebi ile. Context Switch sayısının artması haliyle büyük performans kayıplarına sebebiyet vermekte.
Context Switching maliyetini düşürmek için uygulanacak çözümlerden biri Bulk Processing.
Bu yöntem ile işlenecek veri kümesi BULK COLLECT INTO söz deyimi ile bir kerede diziye atılıp daha sonra FORALL söz deyimi ile bu array minimum context switch ile veritabanına gönderiliyor ve işlemlerin daha hızlı yapılması sağlanıyor.
Örnekte de görüldüğü üzere BULK PROCESSING standart kullandığımız yönteme göre neredeyse 2 kat daha hızlı çalıştı.
Çalışma hızı performansı sistemimize ve işleyecek datanın büyüklüğüne göre pozitif olarak değişkenlik gösterebilir.
Şekilden de anlaşılacağı üzere PL/SQL bloğunda üretilen DML’ler SQL Engine tek tek değil toplu bir şekilde gönderilmekte ve bu sayede daha az context switching yapılmakta. Context Switching in az yapılması uygulamamızın çalışma hızını pozitif yönde etkilemekte.
BULK COLLECT’in kullanıldığı uygulamalarda, uygulamamızın memory tüketimine dikkat etmeliyiz. Eğer işleyeceğimiz veri miktarı büyükse, uygulamamızın memory tüketimini kontrol altına almak için LIMIT söz deyimini kullanmamız sistemin genel kaynak kullanımını pozitif yönde etkileyecektir.
Bulk Processing kabaca şekildeki gibi çalışmaktadır.
Yazdığımız kodlarda en çok dikkat etmemiz gereken konulardan biride memory yönetimi.
Yazdığımız kodlar ve işleyeceğimiz veriler için Oracle tarafından arka planda belirli hafıza alanları tahsis edilir ve bu alanlar sistem ayakta olduğu sürece kullanılır. Bu memory alanları sınırsız olmadığından bu alanların efektif bir şekilde kullanımını yazdığımız kodlar ile belirli seviyede sağlamamız mümkün.
Yazdığımız paket içerisinde tanımladığımız değişkenleri optimize etmek
BULK COLLECT ile LIMIT cümlesi kullanmak
BULK COLLECT ile VARRAY kullanımına dikkat etmek
PARALLEL PIPELINED Fonksiyonların kullanımını arttırmak
Fonksiyon veya Prosedürlere parametre aktarımlarında NOCOPY hinti kullanmak
Yukarıda sıralamış olduğumuz hususlara dikkat etmemiz uygulamalarımızın daha etkin memory kullanmasına olanak sağlayacaktır.
NOCOPY hinti verinin fonksiyon veya prosedürlere pass by reference mantığı ile taşınmasını sağlar. Transfer edilen parametre memory de başka bir alana kopyalanmadığı içinde yazdığımız kod bloğunun tükettiği memory miktarı transfer edeceğimiz parametrenin boyutuna bağlı olarak azalmakta ve genel performansımızı iyileştirmektedir. NOCOPY hinti kullanırken dikkat etmemiz gereken nokta, herhangi bir exception durumunda memoryde değişikliğe uğrattığımız parametrenin orijinal halini kaybetme riskimiz olacaktır. Bu riski göz önünde bulundurarak geliştirmelerimizi yapmalıyız.
Veriyi cachleme yazdığımız programların daha performanslı çalışmasını etkileyen önemli parametrelerin başında gelmektedir. Oracle’ında bu bağlamda bize sunduğu bazı alt yapılar mevcuttur. Bu cacheleme alt yapılarını kullanarak performansı daha iyi olan etkin programlar geliştirebilmekteyiz. Veriyi cachlemek için Oracle bize bazı opsiyonlar sunmaktadır bu opsiyonlardan bazıları aşağıda listelenmiştir.
Deterministic Functions
PGA Caching
Function Result Cache
Yukarıda listelenmiş tekniklerin etkin kullanımı ile uygulamalarımızın veriye erişim sürelerini kısaltarak performans anlamında yüksek kazançlar elde edebilmekteyiz.
Deterministic PL/SQL Functions: (Oracle 8i’den beri mevcut)Eğer deterministic yaratılmış bir fonksyion aynı parametre ile ikinci kez çağırılırsa, optimizer tarafından fonksyion ikinci kez çalıştırılmaz sonuç daha önce o değer için hesaplandığından dolayı otomatik olarak cache den getirilir. Böylelikle aynı parametreler için tekrar tekrar fonskyon çağırımı yapılmaz ve performans kazancı elde edilir.
Caching using PGA: Program Global Area’ya erişmek System Global Area’ya erişmekten daha kolaydır. Dolayısıyla bu alanı efektif olarak kullanmak veri erişim sürelerini kısaltma bazında pozitif sonuçlar doğuracaktır. Özellikle collectionları bu bölge içerisinde tanımlayıp kullanmak erişim performansımızı arttıracaktır.
Function Result Cache: (Oracle 11g ile gelen bir özellik) Function Result Cache aynı parametre ile çağırılan fonskyon için üretilen sonucu cacheler ve tekrar aynı parametre ile fonksyon çağırıldığında sonucu cacheden okur ve fonskyonu çalıştırmaz. RESULT_CACHE ile yaratılan fonksyonlar ile üretilen sonuclar tüm sessionların erişebildiği bir noktada tutularak, farklı sessionlar tarafından da sonucun kullanılmasına olanak sağlamasıdır.
Function Result Cache: Function Result Cache aynı parametre ile çağırılan fonskyon için üretilen sonucu cacheler ve tekrar aynı parametre ile fonksyon çağırıldığında sonucu cacheden okur ve fonskyonu çalıştırmaz. Deterministic fonksiyonlardan farkı, üretilen sonucun tüm sessionların erişebildiği bir noktada tutularak, farklı sessionlar tarafından da sonucun kullanılmasına olanak sağlamasıdır.
RESULT_CACHE cümlesi optimizer’a parametre bazlı sonuçların bu fonksyon için saklanması gerektiğini söyler. Sonuçlar cachelendiği için aynı parametre ile tekrar fonksyon çağırıldığında optimizer sonucu cachledigi anlar ve sonucu cacheden okur.
RELIES_ON cümlesi ise fonksyonun kullandığı tablodaki olası data değişiminin algılanıp (cachedeki sonucun değişimine neden olacak durumlarda) cache deki sonucu invalid hale getirip aynı parametre ile tekrar çağırıldığında fonksyonun yeniden çalışmasını sağlamak olacaktır.
Deterministic PL/SQL Functions: Eğer deterministic yaratılmış bir fonksyion aynı parametre ile ikinci kez çağırılırsa, optimizer tarafından fonksyion ikinci kez çalıştırılmaz sonuç daha önce o değer için hesaplandığından dolayı otomatik olarak cache den getirilir. Böylelikle aynı parametreler için tekrar tekrar fonskyon çağırımı yapılmaz ve performans kazancı elde edilir.