pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
json on child table or not
3+ messages / 2 participants
[nested] [flat]

* json on child table or not
@ 2019-05-31 13:20  PegoraroF10 <marcos@f10.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: PegoraroF10 @ 2019-05-31 13:20 UTC (permalink / raw)
  To: pgsql-general

I have a table with lots of updates in a json field and few updates on other
fields. On that table I have several indices and it is main table of other
lots of child tables.
When querying this table I always do a lateral join with that json field, so
having that field on a separate table wouldn´t be a problem.

Then, for auto vacuum, for indices, for fillfactor and some other reasons,
is it better to have that json on a child table in a 1 to 1 relation ?



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: json on child table or not
@ 2019-05-31 17:08  Michael Lewis <mlewis@entrata.com>
  parent: PegoraroF10 <marcos@f10.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Lewis @ 2019-05-31 17:08 UTC (permalink / raw)
  To: PegoraroF10 <marcos@f10.com.br>; +Cc: pgsql-general

How big does the data stored in that field get? More than 2KB? Real
question- is it getting stored plain, compressed inline, or toasted? Have
you set the storage strategy/type, or is it the "extended" default behavior
that compresses and then stores in the toast table if still more than 2000
bytes?

Always joining on a field that is toasted and compressed is going to be
considerably slower than a discrete field. Do you have an index (or
several) on the json field values? Also, are we actually talking about
jsonb?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: json on child table or not
@ 2019-05-31 18:21  PegoraroF10 <marcos@f10.com.br>
  parent: Michael Lewis <mlewis@entrata.com>
  0 siblings, 0 replies; 3+ messages in thread

From: PegoraroF10 @ 2019-05-31 18:21 UTC (permalink / raw)
  To: pgsql-general

Yes, they are jsonb.
Their length varies between 400 and 2.000 chars, when using
pg_column_size(jsonb field). When casting to text it goes to 1.800 to 3.500
of length.
I didn´t set any storage strategie for that table or field. It´s defined as
x for storage.
No, I don´t have any index on that field.



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-05-31 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 13:20 json on child table or not PegoraroF10 <marcos@f10.com.br>
2019-05-31 17:08 ` Michael Lewis <mlewis@entrata.com>
2019-05-31 18:21   ` PegoraroF10 <marcos@f10.com.br>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox