- Create
UNLOGGED
table. This reduces the amount of data written to persistent storage by up to 2x. - Set
WITH (autovacuum_enabled=false)
on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we neverDELETE
orUPDATE
the table). - Insert rows with
COPY FROM STDIN
. This is the fastest possible approach to insert rows into table. - Minimize the number of indexes in the table, since they slow down inserts. Usually an index
on
time timestamp with time zone
is enough. - Add
synchronous_commit = off
topostgresql.conf
. - Use table inheritance for fast removal of old data:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Jan Marsch (@kekscom) | |
* @example see http://jsfiddle.net/osmbuildings/2e5KX/5/ | |
* @example thickLineToPolygon([{x:50,y:155}, {x:75,y:150}, {x:100,y:100}, {x:50,y:100}], 20) | |
* @param polyline {array} a list of point objects in format {x:75,y:150} | |
* @param thickness {int} line thickness | |
*/ | |
var thickLineToPolygon = (function () { | |
function getOffsets(a, b, thickness) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculates today's sunrise and sunset hours in local time (or in the given tz) for the given latitude, longitude. | |
* The tz parameter is mainly for the possible circumstance that your system timezone does not match the location | |
* you are currently at. | |
* | |
* Computations are based on the formulas found in: | |
* https://en.wikipedia.org/wiki/Julian_day#Converting_Julian_or_Gregorian_calendar_date_to_Julian_Day_Number | |
* https://en.wikipedia.org/wiki/Sunrise_equation#Complete_calculation_on_Earth | |
* | |
* @method suntimes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TLDR; | |
---------------------------------------------------- | |
st_transform( | |
st_buffer( | |
st_transform(st_geomFromText('POINT(145.228914 -37.92674)', 4326), 900913), | |
50 --radius in meters | |
), | |
4326 | |
) | |
---------------------------------------------------- |