Sunday, March 15, 2026

Optimizing Oracle 19c SQL: Key Takeaways

  • Define Clear Tuning Goals: Prioritize what matters – low response time for OLTP vs. high throughput for analytics. Tuning means hitting measurable benchmarks, not guessing.
  • Design for Performance: Build scalability in from day one. Use connection pooling and write queries to “parse once, run many times.” Always use bind variables instead of literals to share cursors and avoid costly hard parses.
  • Know the Optimizer: Oracle’s Cost-Based Optimizer picks plans by estimating cardinality (row counts) and cost (I/O+CPU). Accurate stats (and histograms for skew) are essential. The optimizer’s cost = I/O + CPU + memory, so even small misestimates can flip join types or access paths.
  • Leverage Adaptive 19c Features: Oracle 19c can fix bad plans on-the-fly. For example, it can switch a nested-loop to a hash join mid-execution if row counts are higher than expected. It even re-optimizes SQL automatically if the first execution showed wrong cardinality. In practice this means fewer manual tune cycles – just enable OPTIMIZER_ADAPTIVE_PLANS=TRUE (the default).
  • Keep Statistics Fresh: Let the database do the heavy lifting. Oracle 19c introduces real-time and high-frequency statistics gathering, so the optimizer rarely has stale data. In 19c a light-weight job runs every 15 minutes by default to update stats for tables that changed. Ensure AUTOMATIC_STATISTICS_UPDATE is ON and consider manual FULL gathers when massive data loads occur.
  • Use Automated Advisors: Oracle’s tuning advisors are powerful. The SQL Tuning Advisor can analyze top SQL and even generate SQL Profiles or rewrite recommendations. The SQL Access Advisor will suggest the right indexes, materialized views or partitioning for a workload. Best of all, 19c’s Automatic Indexing can create and test indexes for you, making them visible only if they improve performance.
  • Lock in Good Plans: Enable SQL Plan Baselines (SQL Plan Management) on critical queries to “whitelist” good plans. When a new plan appears, Oracle will only use it if it’s been validated. The new SPM Evolve task in 19c runs frequently to test any new plans behind the scenes and automatically accept the best one. This guards against plan regressions after stats or version changes.
  • Monitor and Diagnose: Keep an eye on queries in real time. Oracle 19c automatically tracks SQL statements that run in parallel or take >5 seconds of CPU/I/O. Use DBMS_SQLTUNE.REPORT_SQL_MONITOR and DBMS_XPLAN to see exactly what’s happening. In 19c, developers can view their own SQL monitor reports without special privileges – a great way to troubleshoot slow queries on the fly.

Practical Tips: Always use bind variables to enable soft parses (reducing library-cache latches). And enable AWR/ADDM (Requires additional license pack) to find top-consuming SQL, then feed those statements to the SQL Tuning Advisor.

Sunday, November 9, 2025

 

Working with Databases Using SQLite in Python

Introduction

Databases are essential for storing, organizing, and retrieving data efficiently. Whether it’s a simple desktop app or a data-driven web application, managing data effectively is key.

If you’re starting your journey with databases or need a lightweight option for your project, SQLite is a great choice. It’s fast, reliable, and comes built into Python; no installation or configuration is required. In this post, we’ll explore how to use SQLite with Python to create, read, update, and delete data with just a few lines of code.


What is SQLite?

SQLite is a self-contained, serverless database engine. Unlike MySQL or PostgreSQL, it doesn’t require a separate server to run your entire database lives in a single .db file.

Key advantages:

  •  Lightweight and fast

  •  No setup required

  •  Ideal for small apps, data analysis, or prototypes

  •  Built directly into Python’s standard library

Step-by-Step Guide: Using SQLite in Python

You can start using it instantly by importing Python’s built-in module:

import sqlite3

1) Create a Connection

To start, connect to a database. If it doesn’t exist, SQLite will create it automatically.

import sqlite3 conn = sqlite3.connect('students.db')

2) Create a Table

Now, let’s create a simple table to store student information.

cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS students ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, grade TEXT ) ''') conn.commit()

3) Insert Data

You can easily insert records into the table.

c.execute("insert into customer values ('John','Stathom','C')")


You can easily insert multiple records into the table.

many_students = [
                    ('Mark',16,'A'),
                    ('Steve',13,'D'),
                    ('Mark',15,'B')
                 ]
cursor.execute("INSERT INTO students VALUES (?, ?, ?)",  many_students)

conn.commit()

4) Retrieve Data

Fetching records is simple with SELECT.

cursor.execute("SELECT * FROM students") rows = cursor.fetchall() for row in rows: print(row)

5)Update or Delete Records

Updating or deleting data uses standard SQL commands.

cursor.execute("UPDATE students SET grade = 'A+' WHERE name = 'Alice'") cursor.execute("DELETE FROM students WHERE age < 18") conn.commit()

6) Close the Connection

Always close your connection once you’re done.

conn.close()


Tuesday, June 17, 2025

ScyllaDB vs Cassandra: What Makes ScyllaDB the Better Choice?

For years, Apache Cassandra has been a go-to NoSQL database for applications that demand high availability and horizontal scalability. It’s widely used and trusted by big names in the industry. But as workloads grow and performance becomes critical, many are starting to explore ScyllaDB a newer, high-performance alternative built with modern hardware in mind.

So what makes ScyllaDB stand out from Cassandra? Here's a look at the key differences and why more teams are making the switch.

1. C++ Instead of Java

The most fundamental difference is in the programming language. Cassandra is written in Java, which means it relies on the Java Virtual Machine (JVM) for memory management. This introduces latency issues due to garbage collection and other runtime overhead.

ScyllaDB, on the other hand, is built in C++. It doesn't use a garbage collector, which results in much more consistent performance. That means no random latency spikes or pauses under load, a major win for real-time applications.

2. Asynchronous, Shared-Nothing Design

Cassandra uses a thread-per-request model and shares memory across threads. As clusters grow, this design can become inefficient and harder to manage.

ScyllaDB was built differently. It uses an asynchronous, shared-nothing architecture where each CPU core handles its own data independently. There's no contention between threads, no locks, and no need to wait on other processes. This leads to significantly better performance, especially as the number of cores increases.

3. Thread-Per-Core Efficiency

ScyllaDB automatically distributes data across CPU cores and disks. Each core runs its own thread, dedicated to handling its portion of the data.

This "thread-per-core" model allows ScyllaDB to scale vertically with the number of cores, making full use of modern multi-core processors. It also means fewer context switches and more efficient CPU usage compared to Cassandra.

4. Predictable Latency and Higher Throughput

When benchmarked side by side, ScyllaDB consistently delivers better throughput than Cassandra  often by 3 to 10 times  while maintaining much lower latency.

Where Cassandra might show unpredictable latency, especially under load, ScyllaDB remains stable and responsive. This is a big advantage for applications like recommendation engines, fraud detection, and IoT platforms where every millisecond counts.

5. Easy Migration with CQL Compatibility

ScyllaDB supports the Cassandra Query Language (CQL), which means it’s API-compatible with Cassandra. Most applications that use Cassandra can be pointed to a ScyllaDB cluster with little or no code changes.

There are also tools provided by ScyllaDB, like the Scylla Migrator, that help automate and simplify the migration process.

6. Easier to Manage and Self-Tuning

One of the pain points with Cassandra is the need to tune dozens of JVM settings, compaction strategies, and cache configurations. It often requires deep expertise to operate Cassandra efficiently at scale.

ScyllaDB simplifies all of this. It is largely self-tuning and handles most configuration tasks automatically. This reduces the need for constant tweaking and makes it easier for smaller teams to manage large deployments.

7. Built-In Monitoring and Management Tools

ScyllaDB comes with built-in tools like Scylla Manager for maintenance tasks and a preconfigured monitoring stack based on Prometheus and Grafana. These tools make it easier to keep an eye on cluster health, schedule repairs, and run backups.

Cassandra has monitoring options too, but many require third-party tools or enterprise licensing.

8. Lower Total Cost of Ownership

Because of its efficiency, ScyllaDB typically requires fewer nodes to handle the same workload as Cassandra. That means you can achieve better performance with less infrastructure, which directly translates to cost savings.

In real-world deployments, some companies have reported reducing their cluster size by half or more after switching to ScyllaDB without sacrificing performance.

 

Why Choose ScyllaDB? 

Features                          Apache Cassandra    ScyllaDB                              
Language Java   C++
Garbage Collection Yes (JVM)   No
Architecture Thread-per-request       Shared-nothing, async
CPU Efficiency Moderate   High (thread-per-core)
Latency Variable   Predictable and low
Throughput Good   3x to 10x better
Operational Complexity High   Low
Compatibility CQL   CQL + DynamoDB API
Cost Higher   Lower (fewer nodes needed)

Final Thoughts

Cassandra has served many companies well, and for good reason. But ScyllaDB builds on the same principles and takes them further with better performance, lower latency, easier operations, and a much lower cost of ownership.

If you're already using Cassandra and feeling the limits, or if you're starting a new project that demands speed and scalability, ScyllaDB is worth serious consideration. It’s a modern database for the modern era without the headaches.

 

Optimizing Oracle 19c SQL: Key Takeaways Define Clear Tuning Goals:  Prioritize what matters – low  response time  for OLTP vs. high  throug...