My Oracle Support Banner

Enabling JSON Check Constraints Takes Forever When Having More Than 2 Mill. Rows (Doc ID 2643040.1)

Last updated on APRIL 17, 2023

Applies to:

Oracle Database - Enterprise Edition - Version 18.3.0.0.0 to 18.9.0.0.0 [Release 18]
Information in this document applies to any platform.

Symptoms

ENABLING JSON CHECK CONSTRAINTS TAKES FOREVER:

CREATE TABLE test_json_constraint (json BLOB NOT NULL);

INSERT INTO test_json_constraint(json)
SELECT utl_raw.cast_to_raw('<JSON_DOCUMENT>')
FROM DUAL CONNECT BY rownum <=2000000;

ALTER TABLE test_json_constraint ADD CONSTRAINT test_json_constraint_json CHECK (json IS JSON FORMAT JSON STRICT WITH UNIQUE KEYS) ENABLE;

our test shows this:
Number_of_Rows  Seconds
10000                    0.24
50000                    4.5
100000                  26.4
200000                  221.7
2000000                30600

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.