Page MenuHomePhabricator

Add custom index creation
Closed, ResolvedPublic

Description

Meddo recommends some custom indexes to speed up rendering. These are included as indexes.sql in the repo, but can also be created by scripts/indexes.py

The script has a few useful options for operating on a production server

optional arguments:
  -h, --help            show this help message and exit
  --concurrent          Generate indexes CONCURRENTLY
  --fillfactor FILLFACTOR
                        Custom fillfactor to use
  --notexist            Use IF NOT EXISTS (requires 9.5)
  --reindex             Rebuild existing indexes

--reindex does the set of statements to rebuild an index without locking:

ALTER INDEX roads_low RENAME TO roads_low_old;
CREATE INDEX CONCURRENTLY roads_low
  ON roads USING GIST (way)
  WHERE class >= 'tertiary';
DROP INDEX roads_low_old;

I'm not sure where we want to put index creation.