码迷,mamicode.com
首页 > 数据库 > 详细

postGIS相关数据库参数

时间:2016-11-07 20:10:16      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:postgresql postgis优化

一、表结构定义

-- Table: public.tbl_buildings


-- DROP TABLE public.tbl_buildings;


CREATE TABLE public.tbl_buildings

(

  id character(7) NOT NULL,

  name character(20),

  type character(10),

  address character(30),

  the_geom geometry,

  CONSTRAINT tbl_buildings_pkey PRIMARY KEY (id)

)


列变更

SELECT DropGeometryColumn(‘tbl_properties‘, ‘the_geom‘)

SELECT AddGeometryColumn(‘tbl_properties‘, ‘the_geom‘, 4326,

‘POINT‘, 2);

添加数据

INSERT INTO tbl_properties ( id, town, postal_code, street,

"number", the_geom)VALUES (1, ‘London‘, ‘N7 6PA‘, ‘Holloway Road‘,

32, ST_GeomFromEWKT(‘SRID=4326;POINT(51.556173 -0.116190)‘));


二、geometry列建立gist索引


CREATE INDEX idx_geo_buildings ON tbl_buildings USING GIST ( the_geom );


三、数据库参数

1.checkpoint_segments(9.5 ago)

Default value:3

Suggested value:6

-----------------------------------

max_wal_size(after 9.5)

Default value:1 GB


2.constraint_exclusion

Default value:Deactivated

Suggested value:Activated, partition


3.maintenance_work_mem

Default value:16

Suggested value:128


4.random_page_cost

Default value 4.0

Suggested value 2.0



5.shared_buffers

Default value :32 MB

Suggested value: 64 MB to 512 MB unlikely for an allocation of more than 40 percent

of RAM(windows),25% physical memory(Linux)


6.wal_buffers

Default value:64kb

Suggested value:1MB


7.work_mem

Default value:1MB

Suggested value:16MB


以上均为建议值,具体需要根据系统运行情况修改。

本文出自 “yiyi” 博客,请务必保留此出处http://heyiyi.blog.51cto.com/205455/1870227

postGIS相关数据库参数

标签:postgresql postgis优化

原文地址:http://heyiyi.blog.51cto.com/205455/1870227

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!