Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hK8rS-00055P-EN for pgsql-general@arkaria.postgresql.org; Fri, 26 Apr 2019 21:58:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hK8rQ-0003u6-2k for pgsql-general@arkaria.postgresql.org; Fri, 26 Apr 2019 21:58:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hK8rP-0003tY-M2 for pgsql-general@lists.postgresql.org; Fri, 26 Apr 2019 21:58:23 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hK8rN-00004z-Dm for pgsql-general@lists.postgresql.org; Fri, 26 Apr 2019 21:58:22 +0000 Received: by mail-pg1-x543.google.com with SMTP id n2so2197213pgg.13 for ; Fri, 26 Apr 2019 14:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=qRI9EyeOwQIq6cd7Ygmrlft9H5OxEbHcGbfwrTxjjdY=; b=LhJ+Od0SnvGrjxhQBBxVQEJFt4eZ76imldZjx7/cEYKOweGB8R+SF7DCq5OXAYqSmP 5fYBz2xJ77EGHtZeSFNUfQoSdMFUsKHPTsKH3wQbbAc51ENHI0Iaf03JE9NjG/MT4PzY 7LSgma/ID0ep9jSdud5thgmolpZA4FsY6mMZUVYHwvectkv1zSNt9cV6rU44Y72HwApx Kua1mNDont1gFCKI57YAPW2gYRpVG2E7rqxBWnd9lThft+4rayuLrXSZ+10psUZuX6JX gV2wGKi9WdnV5fsuE0CHfIQnmQ6N6Sgpt/f9+jZsCqcX8xmK6nSMnHPagMgrgdA2TvjY OmgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=qRI9EyeOwQIq6cd7Ygmrlft9H5OxEbHcGbfwrTxjjdY=; b=ZSBS1YcavxHqtimyNSqYIrLb21vfAde6LaokItzJXcQUA6P80sy0txnKAJWR5rH0Ca 2G7i5TBMP/uSa1/10VSG0XrX3JNM5zAEsksWl63O594S/uyiruRsUI6WIerKtPfxtRug THrtvPiy8QPNXXiRFqetGFEDyN8b65lG4yOGzwcxT2oTnWZGfZFz4ktBZF/5vZtROCtL his30wLICGhUuJ1BvNxlt8eKhFlSKz4CXXNRjltpwEv8uw7a7ZlaBv07+vSx0AnEcQ1H dkqpqJloPfTqIHdJC0z8wneEvSSf2m9Z/n32FOqtfJE0xkOWQNykt8wZGDKAgZTPAJje 9TfQ== X-Gm-Message-State: APjAAAXMsa2u4RlyHzTS2qxbEMllKFJA175VdBRCv8yO0PrXwA3lzmbn lDFfmn+LVwVX8PnItSetPgh01zxS X-Google-Smtp-Source: APXvYqzt04LKs49mw3eYi6ZWdLDYG1SUZ8DMLcYnfwjP0SkYh1WcbTxJN+AL8RQmrPwTkS8D+jcE2g== X-Received: by 2002:a65:6659:: with SMTP id z25mr45664228pgv.10.1556315900073; Fri, 26 Apr 2019 14:58:20 -0700 (PDT) Received: from [10.104.134.41] ([155.100.47.1]) by smtp.gmail.com with ESMTPSA id 128sm31234935pgb.47.2019.04.26.14.58.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 14:58:19 -0700 (PDT) Subject: Re: Computed index on transformation of jsonb key set To: pgsql-general@lists.postgresql.org References: <8A0F49D1-CA16-445B-BC4E-F53E9925809C@gmail.com> <996b3096-a521-521e-5d10-0978de5f5052@gmail.com> <0E4CECBC-F22A-4EE2-9E71-5ABA9EB89DFC@gmail.com> From: Rob Sargent Message-ID: <3f0002f7-5967-10d7-e076-c33448149596@gmail.com> Date: Fri, 26 Apr 2019 15:58:18 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <0E4CECBC-F22A-4EE2-9E71-5ABA9EB89DFC@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/26/19 3:53 PM, Steven Schlansker wrote: > >> On Apr 26, 2019, at 2:33 PM, Rob Sargent wrote: >> >> >> On 4/26/19 3:25 PM, Steven Schlansker wrote: >>> >>> How can I efficiently implement the feature I've described? It seems difficult to use computed indexing with GIN. >>> >> Storing the map in a child table (parentId, UUID, int) is out of the question? > Yes, thanks Rob and David, that will be my approach if I can't figure out anything better. > > I was hoping to not have to denormalize the data given that Postgres generally has great support for computing indexes, > both to avoid storage costs and eliminate the need to maintain triggers or application code to handle it. > > > Is that json structure really more compact than the matching table (even with the additional parent id)?