Re: [HACKERS] [PATCH] Generic type subscripting

Dmitry Dolgov <9erthalion6@gmail.com>

From: Dmitry Dolgov <9erthalion6@gmail.com>
To: Arthur Zakirov <a.zakirov@postgrespro.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, Michael Paquier <michael.paquier@gmail.com>, Oleg Bartunov <obartunov@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, David Steele <david@pgmasters.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-02-22T17:30:32Z
Lists: pgsql-hackers

Attachments

> On 30 January 2018 at 16:47, Dmitry Dolgov <9erthalion6@gmail.com> wrote:
> > On 29 January 2018 at 14:41, Arthur Zakirov <a.zakirov@postgrespro.ru>
wrote:
> >
> > I have a few comments.
>
> Thanks for suggestions, I've incorporated all of them in a new version of
the
> patch.

Few more updates. I've attached a new version with some minor changes,
mostly
about moving a subscripting depth check to type related logic. Also I've
made
some performance tests for arrays using pgbench:

    pgbench -c 10 -j 2 -T 600 -f test.sql -r

with queries like:

    select (ARRAY[1, 2, 3])[0];
    select (ARRAY[1, 2, 3, ...,  98, 99, 100])[0];
    select (ARRAY[[[[[[1]]]]]])[1][1][1][1][1][1];
    select (ARRAY[[[[[[1, 2, 3]]]]]])[1][1][1][1][1:2];

and the difference in average latency was about 2%:

* with the patch

    number of transactions actually processed: 349211
    latency average = 1.718 ms
    tps = 5820.048783 (including connections establishing)
    tps = 5820.264433 (excluding connections establishing)

* without the patch

    number of transactions actually processed: 356024
    latency average = 1.685 ms
    tps = 5933.538195 (including connections establishing)
    tps = 5934.124599 (excluding connections establishing)

Commits

  1. Throw error when assigning jsonb scalar instead of a composite object

  2. Filling array gaps during jsonb subscripting

  3. Implementation of subscripting for jsonb

  4. Allow ALTER TYPE to update an existing type's typsubscript value.

  5. Allow subscripting of hstore values.

  6. Support subscripting of arbitrary types, not only arrays.

  7. jit: Reference function pointer types via llvmjit_types.c.

  8. Teach contain_leaked_vars that assignment SubscriptingRefs are leaky.

  9. jit: Correct parameter type for generated expression evaluation functions.

  10. Renaming for new subscripting mechanism

  11. Fix assertion failure for SSL connections.

  12. Teach eval_const_expressions() to handle some more cases.