4 ms·
The last place I worked had some JSON columns and doing lots of JSON operations tended to eat up all the Postgres CPU (the servers were generally 16-32 cores)
by nijave 3y ago
The last place I worked had some JSON columns and doing lots of JSON operations tended to eat up all the Postgres CPU (the servers were generally 16-32 cores)
- ddorian43 3y agoNative columns are better/faster.
- ttfkam 3y agoWe had that too. Partial expression indexes mitigated most of the performance problems and CPU load. We then created consistently-named functions that made the appropriate JSON query. Then an expression index on the function. If the key was missing (NULL result), it wasn't added to the index, and we stripped all JSON nulls before storing. It wasn't necessarily pretty, but neither was the client's source data, which we had little to no control over. Best of a bad situation. Jsonb columns required more steps afforded us more flexibility and timeliness when the client kept asking for "one more feature" at the last minute.