Commit ea6dba8b authored by Ignacio's avatar Ignacio
Browse files

Añade README y crea vista de los últimos registros

parent a18c9209
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
# AIS Postgres
Base de datos PostgreSQL para almacenar datos AIS.

La tabla principal está particionada por tiempo, de esta forma sólo se accede agiliza las búsquedas que impliquen consultas por fechas.
+5 −0
Original line number Diff line number Diff line
@@ -78,4 +78,9 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
	UPDATE partman.part_config SET infinite_time_partitions = true;
	SELECT cron.schedule('@${INTERVAL}', \$\$SELECT partman.run_maintenance_proc(p_analyze := false)\$\$)

	CREATE VIEW ais.last_20m AS SELECT DISTINCT ON (mmsi) *
	FROM ais.location
	WHERE tstamp > current_timestamp - interval '20 minutes'
	ORDER BY mmsi, tstamp DESC;

EOSQL
 No newline at end of file