Oracle 19c Developer: Super Fast JSON Handling with New Features


Oracle Database 19c brings major improvements in JSON handling, making it production-ready for modern applications. Developers can now store, query, and index JSON documents with near-relational performance.

Why JSON in Oracle 19c is a Game Changer

  • Native JSON data type with automatic validation
  • High-performance JSON search indexes
  • Powerful SQL/JSON functions with better optimization
  • Seamless integration with existing relational data

1. Creating JSON Columns & Tables

CREATE TABLE api_logs (
    log_id        NUMBER GENERATED ALWAYS AS IDENTITY,
    log_date      DATE DEFAULT SYSDATE,
    payload       JSON,                    -- Native JSON type
    CONSTRAINT json_check CHECK (payload IS JSON)
);

2. Inserting JSON Data

INSERT INTO api_logs (payload) VALUES (
    JSON_OBJECT(
        'user_id' VALUE 12345,
        'action' VALUE 'login',
        'status' VALUE 'success',
        'items' VALUE JSON_ARRAY(10, 20, 30),
        'metadata' VALUE JSON_OBJECT('ip' VALUE '192.168.1.1', 'browser' VALUE 'Chrome')
    )
);

3. Super Fast Querying

-- Simple queries
SELECT 
    payload.user_id,
    payload.status,
    JSON_VALUE(payload, '$.metadata.ip') AS client_ip
FROM api_logs 
WHERE JSON_EXISTS(payload, '$.action');

-- Complex filtering (very fast with index)
SELECT * FROM api_logs 
WHERE JSON_VALUE(payload, '$.status') = 'success'
  AND JSON_EXISTS(payload, '$.items[*]?(@ > 15)'); 

4. JSON Search Index (The Real Performance Booster)

-- Create a search index (highly recommended for production)
CREATE SEARCH INDEX api_logs_idx ON api_logs(payload) 
FOR JSON 
PARAMETERS('SYNC EVERY 5 MINUTES');

-- Oracle automatically maintains this index

Performance Tip: JSON search indexes can improve query speed by 10x–100x on large datasets.

5. Updating & Merging JSON

-- Update specific fields
UPDATE api_logs 
SET payload = JSON_MERGEPATCH(payload, 
    JSON_OBJECT('status' VALUE 'failed', 'error_code' VALUE 401))
WHERE log_id = 100;

Best Practices for Developers

  • Always create a JSON Search Index on frequently queried columns.
  • Use JSON_SERIALIZE when returning large JSON to clients.
  • Combine JSON with relational columns for hybrid models.
  • Monitor index usage with DBA_INDEX_USAGE.
  • Avoid storing extremely large JSON documents (> 32KB) in one column.

Conclusion

With Oracle 19c’s enhanced JSON capabilities, developers can build modern APIs and microservices without needing a separate NoSQL database. The combination of native JSON type + search indexes gives you the best of both relational power and document flexibility.

Start using JSON today — your queries will thank you!

Oracle 19c | JSON | Developer Tips | Performance

Tags: Oracle 19c, JSON, SQL/JSON, JSON Search Index, Developer Features

Post a Comment

Previous Post Next Post