Zum Inhalt springen
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
Referenzen Technologien Blog Know-how Tools
Über uns Zusammenarbeit Karriere
CS EN DE
Lassen Sie uns sprechen

PostgreSQL JSON operace

12. 12. 2024 1 Min. Lesezeit intermediate

PostgreSQL má prvotřídní JSON podporu s JSONB.

Operátory

SELECT data->>’name’ FROM events; SELECT * FROM events WHERE data->>’type’=’click’; SELECT * FROM events WHERE data @> ‘{“type”:”click”}’; SELECT * FROM events WHERE data ? ‘email’;

Indexy

CREATE INDEX idx_data ON events USING GIN (data); CREATE INDEX idx_type ON events ((data->>’type’));

Manipulace

UPDATE users SET data=data||’{“verified”:true}’; UPDATE users SET data=data-‘temp’; UPDATE users SET data=jsonb_set(data,’{address,city}’,‘“Praha”’);

JSONB = flexibilita + výkon

GIN index pro rychlé dotazy.

postgresqljsonjsonb
Teilen:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.