[Tile-serving] [openstreetmap/osm2pgsql] New "flex" backend (#1036)

ImreSamu notifications at github.com
Sat Dec 21 13:59:14 UTC 2019


Thank you for working this topics ! 

> We provide Lua
> functions define tables and their columns. 

Would it be possible to add "a lua definition" of full table codes?  
so all SQL code templates ( and business logic )  will be in Lua.

some examples - now in c++ and I would like to re-define/extend in Lua.
- `" CREATE UNLOGGED TABLE IF NOT EXISTS ..."`
- `" WITH ( autovacuum_enabled = FALSE )"`


imho :

With the LUA based flexible table creation code ( or template ) with an SQL knowledge - easy to implement:
- table partitioning ( PG11-12 ) https://fragland.dev/a-guide-to-table-partitioning-with-postgresql-12/
- using PG Pluggable Storage API - ( [Zheap](https://github.com/EnterpriseDB/zheap)  or  [zedstore](https://github.com/greenplum-db/postgres/tree/zedstore)  )
   - `CREATE TABLE amenity(key text, value text) USING zheap;`
   - `CREATE TABLE shops(key text, value text)   USING zedstore;`

- using/tunning  GreenPlum https://greenplum.org/ database  
     -  https://gpdb.docs.pivotal.io/43330/ref_guide/sql_commands/CREATE_TABLE.html 
- using ( [CockroachDB](https://www.cockroachlabs.com/blog/why-postgres/)  ~ Postgres compatible ) database ; 
   -   https://github.com/cockroachdb/cockroach/issues/19313 
- using other pg compatible databases , and adding special options 
     -  https://wiki.postgresql.org/wiki/PostgreSQL_derived_databases
 

And with a simple Lua scripting :
-  we can generate optimized sql code for
   -  different SQL versions. ( `PG9.6` vs. `PG11` vs. `PG13` ) 
   -  different PostGIS versions  

With a simple Lua - we can add new PG syntaxes - now and later, like
- "Generated Columns" https://www.postgresql.org/docs/12/ddl-generated-columns.html
    - `height_in numeric GENERATED ALWAYS AS (height_cm / 2.54) STORED`

In this case  ~all ["business logic"](https://en.wikipedia.org/wiki/Business_logic) will be scriptable in LUA; 
and developers with Database/Scripting  Background ( without C++ knowledge )  - can extend the system.   ( Like me  )
 
----------------------

My extra wishlist  ( adding the possibility for easy implementation later )  :
supporting non PostgreSQL compatible databases ( later ) .
like:
- csv backend support ( writing the results to the csv files ) 
- Sqlite3, SpatiaLite
- Mysql 
- Clickhouse ( https://clickhouse.yandex/ ) 
-  ... 

-- 
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1036#issuecomment-568183022
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20191221/829162db/attachment.html>


More information about the Tile-serving mailing list