Show HN: Pg_jsonschema – A Postgres extension for JSON validation
Nice work, however, I am structurally dubious of putting too much functionality onto a classical centralized RDBMS since it can&#x27;t be scaled out if performance becomes a problem.  It&#x27;s CPU load and it&#x27;s tying up a connection which is a large memory load (as implemented in postgres, connections are &quot;expensive&quot;) and since this occurs inside a transaction it&#x27;s holding locks&#x2F;etc as well.  I know it&#x27;s all compiled native code so it&#x27;s about as fast as it can be, but, it&#x27;s just a question of whether it&#x27;s the right place to do that as a general concern.<p>I&#x27;d strongly prefer to have the application layer do generic json-schema validation since you can spawn arbitrary containers to spread the load.  Obviously some things are unavoidable if you want to maintain foreign-key constraints or db-level check constraints&#x2F;etc but people frown on check constraints sometimes as well.  Semantic validity should be checked before it gets to the DB.<p>I was exploring a project with JSON generation views inside the database for coupling the DB directly to SOLR for direct data import, and while it worked fine (and performed fine with toy problems) that was just always my concern... even there where it&#x27;s not holding write locks&#x2F;etc, how much harder are you hitting the DB for stuff that, ultimately, can. be done slower but more scalably in an application container?<p>YAGNI, I know, cross the bridge when it comes, butjust as a blanket architectural concern that&#x27;s not really where it belongs imo.<p>In my case at least, probably it&#x27;s something that could be pushed off to followers in a leader-follower cluster as a kind of read replica, but I dunno if that&#x27;s how it&#x27;s implemented or not.  &quot;Read replicas&quot; are something that are a lot more fleshed out in Citus, Enterprise, and the other commercial offerings built on raw Postgres iirc.