[postgis-devel] Tiny WKB
=?UTF-8?Q?Nicklas_Av=E9n?=
nicklas.aven at jordogskog.no
Wed Mar 6 00:36:04 PST 2013
Sorry Mateusz, I think I sent the last one only to you.
I have not had time to do any testing, but I doubt json format can be that slimmed or fast.
It is not even handling relative coordinates as I understand.
The "header" of each geom also seems to be both the word "type", the type as characters and the word "coordinates"
the header of twkb is 6 bytes for a POINT including, "id", "number of dimensions", "type" and "precision". And the endianess flag.
the header of a LINESTRING is 10 bytes also including "number of points"
and the polygon has also number of rings so another 4 bytes.
and 4 more bytes for number of points in each ring
So a one ring polygon has a header of 14 bytes, including 4 bytes of id.
It also seems that it gives a good speed up on the server that the amount of data is stripped directly.
I did a test doing
CREATE TABLE test AS
SELECT ST_AsBinary(geom) FROM my_table;
It took 6.5 seconds and gave a 330 mb table.
The same thing with ST_AsTWKB without decimals took 3.5 s and gave 103 mb table.
So the overhead in creating the twkb is smaller than the cost of handling the extra data in the database.
Of course the discwriting is also a player here, but that disc is ssd and somewhere the data should go anyway.
How heavy the reading is on the client side is also a factor. I guess my reader can be optimized, but it seems to perform well. It is no parsing of strings, just reading binary data with some rules about how long a coordinate is.
But I will try to get some time this evening to compare different formats.
Thanks
Nicklas
2013-03-06 Mateusz Loskot wrote:
On 5 March 2013 23:27, Nicklas Avén wrote:
>>
>> I tested on a dataset with 10000 linestrings. With wkb the client
>> recived 2.14 mb. With twkb and 1 decimal precision 670 kb and twkb with
>> integer values 420 kb.
>
>Is this dedicated to Web clients?
>Have you considered comparing with "Content-Encoding: gzip" on server?
>
>Best regards,
>--
>Mateusz Loskot, http://mateusz.loskot.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20130306/fd9eff19/attachment.html>
More information about the postgis-devel
mailing list