Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WhoMU-0006vE-Vo for pgsql-hackers@arkaria.postgresql.org; Tue, 06 May 2014 23:01:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WhoMU-0001HR-EO for pgsql-hackers@arkaria.postgresql.org; Tue, 06 May 2014 23:01:22 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WhoMS-0001Fm-T4 for pgsql-hackers@postgresql.org; Tue, 06 May 2014 23:01:21 +0000 Received: from mail-ob0-f175.google.com ([209.85.214.175]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WhoMP-0002Lb-FH for pgsql-hackers@postgresql.org; Tue, 06 May 2014 23:01:20 +0000 Received: by mail-ob0-f175.google.com with SMTP id wo20so214974obc.20 for ; Tue, 06 May 2014 16:01:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=F+DEVuekkQ/fcsy+b7nVDFxYrRqaWV2FiWsEDqGoqdk=; b=XEXJBA8JjFeIvl3BaeHSLc8SRf6M9WCJEW8kqv8FXKZb/w85Of9xR5KxeIZsxMfr28 KQb4biU4QqtmTvdLgVcfgeR3sVoOiqCK3szrFSx8JWZGN7IUhphwae6XYaCfFK7JcWX8 UYS0E4CYSoOo+u3QoBuhK++2phoROJNWAL7+17VUFghFwUMZ7SL2JytehMEViERjre/d qSAUe1cwB6ZYPmcj+oi0y0edgcc4JLo4rtGAh6hXtMwaNOF/yO+LjELHMlkYkz/ff6e3 uqfT1C70EaZ5wfQDDItX84bYi3ZVSUOWoLqMYBcdi6wm/iOeZbmwGuXq5zZ7uflHZ4gl K1FA== X-Gm-Message-State: ALoCoQl7Z652qgbX8eO/m56NOkNL3jm23m11EErfxoZzlTI3zfXb51vG5dnFp0X57Q+ygDaYBnmt MIME-Version: 1.0 X-Received: by 10.182.117.195 with SMTP id kg3mr40230379obb.17.1399417276880; Tue, 06 May 2014 16:01:16 -0700 (PDT) Received: by 10.182.176.67 with HTTP; Tue, 6 May 2014 16:01:16 -0700 (PDT) In-Reply-To: <29011.1399415977@sss.pgh.pa.us> References: <534475B7.6020908@dunslane.net> <5344EAA4.1050605@vmware.com> <30137.1397057056@sss.pgh.pa.us> <20140422223230.GL10046@momjian.us> <16527.1398214220@sss.pgh.pa.us> <20140506201048.GI30817@momjian.us> <16769.1399407530@sss.pgh.pa.us> <20140506212020.GK30817@momjian.us> <57E8AA44-F816-45F2-BB61-5A854FFB0A97@justatheory.com> <28554.1399414853@sss.pgh.pa.us> <29011.1399415977@sss.pgh.pa.us> Date: Tue, 6 May 2014 16:01:16 -0700 Message-ID: Subject: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation) From: Peter Geoghegan To: Tom Lane Cc: "David E. Wheeler" , Bruce Momjian , Greg Stark , Robert Haas , Heikki Linnakangas , Andrew Dunstan , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, May 6, 2014 at 3:39 PM, Tom Lane wrote: > Meh. I would not think that that represents effective use of JSON: > if the rows are all the same, why aren't you exposing that structure > as regular SQL columns? IMHO, the value of JSON fields within a SQL > table is to deal with data that is not so well structured. I used to think that. That actually isn't what people want from a JSON type, though. People want a flexible data model, but they still realize that if within a table/"collection" everything is totally heterogeneous, it becomes impossible to effectively query. They don't want to run migrations. Or, maybe they are consuming JSON from a third-party API, and have no control over the schema, even though it is really is a schema (already represented as JSON, making jsonb a compelling representation) -- that's a very common use case. It's much more compelling to store semi-structured data as JSON. Totally unstructured data just isn't that interesting. Don't take my word for it, though. See http://docs.mongodb.org/manual/data-modeling, for example. There is an implicit assumption throughout that most documents within a MongoDB collection have the same keys. The choice to not separately index keys in the GIN hash opclass is far from arbitrary, even if you don't agree with it. > In any case, it was certainly the complaint that insertions might > fail altogether that made me (and I assume others) want to not have > jsonb_ops as the default opclass. Is there a good reason not to > fix that limitation while we still can? I have no objection to either changing the default, or having no default. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers