1. 4
  1.  

  2. 2

    If memory serves, there are more subtle ways to leverage indexing on the jsonb type. It may not be best perf-wise to index all the things.

    1. 2

      Yes, you definitely can add any sort of functional b-tree index on any field in JSONB. For most cases, I’ve found that creating a GIN index gives you quite a bit of flexibility without having to think too much ahead of time on what you want to index. If you’re using JSONB in production and there are only a few keys you do want to pay attention to them that approach should work fine, if it’s less defined a GIN index is helpful.