[postgis-devel] gserialized-v2

Paul Ramsey pramsey at cleverelephant.ca
Sat Jun 22 08:37:48 PDT 2019


On Sat, Jun 22, 2019 at 1:05 AM Sandro Santilli <strk at kbt.io> wrote:
>
> On Fri, Jun 21, 2019 at 03:01:54PM -0700, Paul Ramsey wrote:
>
> > - gserialized_from_lwgeom() (and the two functions riding on top of
> > it, geometry_serialize() and geography_serialize(), which are
> > preferred when calling from inside ./postgis) will write out v2
> > geometries, so databases will slowly get re-written with the new form
> > over time
>
> What I'd like to be able to do:
>
>   1. See the info about serialization version and full flagset from ST_Summary

That means letting st_summary see down into the serialization again,
which is contra to what i'm trying to achieve. The user level (lwgeom)
is being walled off from the serialization.

>   2. Compare ST_MemSize(force_v1(v1)) and ST_MemSize(force_v2(v2))
>      (this would need exposing V1 encoding to the SQL level)

Really don't want to expose internals to userland, especially SQL land.

>   3. Use `UPDATE mytable SET geom = ST_Noop(geom)` to force all things to v2

The minimal thing required to cause a re-write is
deserialize/serialize, which is not *quite* a no-op.

> > - The extra flag space on gflags that has been freed up by moving the
> > IsSolid flag into the xflags area could be used of an IsPoint flag, to
> > allow a lightweight point type. A lightweight x/y point could then be
> > 24 bytes (varsize + srid/flags + x + y) instead of 32 bytes (varsize +
> > srid/flags + type + padding + x + y), for a 25% savings for simple
> > points.
>
> This is a good one!
>
> Where's the serialized version info, btw ?

In the end of the gflags. Check the contents of gserialized.h and gserialized2.h

> Would you show some C structs in this thread ? :)

Structs didn't actually change, just the handling of the flags and
addition of more optional stuff after the srid/flags space.

> Note my `make check` fails  pretty early with
>   ../loader/Point ........ failed (dumper geog test: dumping loaded table: /tmp/pgis_reg/dumper.err)

Make sure you have a completely clean build.

P

>   -----------------------------------------------------------------------------
>   Initializing...
>   Done (postgis major version: 3).
>   Output shape: Point
>   Dumping: XUnknown WKB type (0) for record 0
>
>
> --strk;
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel


More information about the postgis-devel mailing list