On Monday, May 15, 2017 at 9:58:57 AM UTC-4, Mike Bayer wrote: > > I'd be curious to see under what scenarios being able to set one element > of the JSON > vs. UPDATEing the whole thing is a performance advantage significant > compared to the usual overhead of the ORM flush process; that is, > Postgresql is really fast, and for this optimization to be significant, > you probably need to be calling the Core function directly anyway rather > than going through the whole ORM flush process.
I did a bunch of tests on this a while back, but in regards to the very-similar HTSORE column and some tests on JSONB. The big takeaways-- * after a certain amount of data is in the column, the most significant issue is bandwidth and timing from the payload transfer. * there is a decent performance update if you're in a sweet spot where the column payload is TOASTable and that's the only update. in that instance, postgres just updates the toast table -- otherwise it does the standard routine of "mark the old row for deletion, copy the row and update it as the new row". toasting a jsonb column has been tweaked a lot, the last time I checked it had to be "just right" -- big enough to toast, but small enough to fit in a single toast column. tldr, it won't noticeably affect performance for most situations. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.