create_master_snc_table.sql
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- Creación de Tabla Maestra Nacional de Lotes SNC
DROP TABLE IF EXISTS public.snc_raw_lotes_activos CASCADE;
CREATE TABLE public.snc_raw_lotes_activos (
sigem_id SERIAL PRIMARY KEY,
id integer,
objectid numeric,
id_parcela numeric,
dpto text,
dist smallint,
padron integer,
zona integer,
mz integer,
lote integer,
finca integer,
nro_matricula text,
ccatastral text,
obs text,
mz_agr text,
lote_agr text,
tipo_pavim text,
tipo_cuenta smallint,
hectareas numeric(20,6),
superficie_tierra numeric(20,6),
superficie_edificado numeric(20,6),
valor_tierra numeric(20,2),
valor_edificado numeric(20,2),
tipo smallint,
referencia smallint,
clave_comparacion text,
snc_cuenta text,
ccc text,
geom geometry(MultiPolygon, 4326),
fecha_ingesta timestamp default now()
);
-- Índices de Performance
CREATE INDEX idx_snc_raw_geom ON public.snc_raw_lotes_activos USING GIST(geom);
CREATE INDEX idx_snc_raw_ccatastral ON public.snc_raw_lotes_activos(ccatastral);
CREATE INDEX idx_snc_raw_ubica ON public.snc_raw_lotes_activos(dpto, dist);
CREATE INDEX idx_snc_raw_ccc ON public.snc_raw_lotes_activos(ccc);