I'm new to spatial algorithms and PostGIS functionality. Currently I have a Pg 10 + Postgis 2.4 database with table of more than 400 000 records (points with additional properties), with Node.JS tile server that generates and serves tiles for Mapbox GL JS plugin using PostGIS ST_ASMvt
function. An d everything seems ok (generates very fast, caching without problems, etc), but there is one problem.
The problem is very big tiles (more than 2 mb) with big amount of features, so Mapbox GL JS renders it veeery sloooowly and eat a lot of memory (sometime my app is chrashing even on my laptop with 16 gb RAM). I can't just reduce the number of features by SQL LIMIT
(just believe me, there are some business problems with the data in this case and on the map it looks very ugly).
And I think that I need to cluster some points that have a big density. So I want to merge the neighbors (and show as one point) at a high zooms and I think it will help with the memory and rendering speed (because of lesser number of features and tile size). But I don't know and cant find how to do this.