2
다른 데이터베이스에 연결해야하므로 dblink가 포함 된이 쿼리는 너무 느립니다 (124 레코드의 경우 50.343 초). 빨리 할 수있는 방법이 있습니까? 다니엘로postgresql 느린 쿼리 (dblink 및 내부 조인)
select *
from
customer
INNER JOIN
dblink('host=192.168.3.9 dbname=db2 user=postgres password=postgres', '
SELECT
status,
last_churn_1,
attempts,
last_dialed,
lead_id,
date_added
FROM campaign_customer
') AS table2 (
status char(50),
last_churn_1 char(50),
attempts int,
last_dialed char(250),
lead_id char(8),
date_added char(50)
) ON customer.phone1 = table2.last_dialed
where customer.leadid = '3434' and table2.lead_id='3434'
는이 쿼리의 ANALYZE'을 EXPLAIN'보여줄 수 아래 코드는? –
가능한 한 많이 where 절을 dblink 쿼리로 이동하십시오. 그렇지 않으면 실행 프로그램이 전체 원격 테이블을 검색합니다. 또한 아마도'table2'는's'가되어야할까요? –
@ DanielVérité ok 그것을 시도해보십시오. –