小编Tom*_*eif的帖子

改进 SQL 查询

我正在寻找如何加速仅基于两个表的查询的想法。我添加了索引,运行真空。

表格:

CREATE TABLE vintage_unit
(
  id integer NOT NULL,
  vintage_unit_date date,
  origination_month timestamp with time zone,
  product character varying,
  customer_type character varying,
  balance numeric,
  CONSTRAINT pk_id_loan PRIMARY KEY (id)
);

CREATE INDEX id_vintage_unit_date  ON vintage_unit USING btree (vintage_unit_date);   
CREATE INDEX ind_customer_type ON vintage_unit USING btree (customer_type COLLATE pg_catalog."default");
CREATE INDEX ind_origination_month ON vintage_unit USING btree  (origination_month);    
CREATE INDEX ind_product ON vintage_unit USING btree (product COLLATE pg_catalog."default");


CREATE TABLE performance_event
(
  id integer,
  event_date date
);

CREATE INDEX ind_event_date ON …
Run Code Online (Sandbox Code Playgroud)

postgresql

5
推荐指数
1
解决办法
420
查看次数

标签 统计

postgresql ×1