database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 8757 게시물 읽기
No. 8757
쿼리좀 봐주세요..
작성자
이기자(k3i2)
작성일
2011-01-04 11:50ⓒ
2011-01-04 17:56ⓜ
조회수
7,943

SELECT a.yb,
 a.deung_day, a.command,
 case coalesce(a.ok_yn,'')when'Y'then'적립'else'미적립'end as ok_yn,
 case coalesce(a.hg_yn,'')when'Y'then'발행'else'미발행'end as hg_yn,
 case coalesce(lmulcode,'')when '' then '' else '증정'end as book
    FROM t_sugangsave_gita a left outer join
    dblink('hostaddr=221.151.xxx.72 port=5432 dbname=sc_book user=postgres password=0000',
      'SELECT distinct t_sale.yb, max(t_sale.mid)as mid, max(t_sale.mulcode)as mulcode
       from t_sale left outer join t_mulpum m on m.mid=t_sale.mid and m.mulcode=t_sale.mulcode group by t_sale.yb
        ') as (lyb varchar(10),lmid varchar(20),lmulcode varchar(15)) on a.mid=lmid and a.yb=lyb
 Where a.mid='scall' and a.stu_c=10051556

문제는  다른 DB에 있는 case coalesce(lmulcode,'')when '' then '' else '증정'end as book 하나를 구하기 위해서 dblink를 걸어
속도가 떨어지다는 겁니다.
dblink가 잘못되었거나 다른 좋은 방법이 없나요?

 

[Top]
No.
제목
작성자
작성일
조회
8760시스템 이행에 따른 컬럼타입 문제.
슝슝이
2011-01-14
7510
8759가변데이터 처리시 테이블 분할과 배열 처리중 뭐가 더 효율이 좋을까요? [1]
노지석
2011-01-11
7764
8758query 가 느려서 explain 했는데 seq 스캔을 하는데, 어떻게 해야 하나요?? [3]
김영호
2011-01-10
9527
8757쿼리좀 봐주세요..
이기자
2011-01-04
7943
8756pg_hba.conf 설정 관련 [2]
강진묵
2011-01-03
8693
8755PB에서 DB연결후 현재시간 가져오기 [2]
이기자
2010-12-31
8537
8753Substring에서 한글문제.. [7]
이기자
2010-12-29
10572
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.017초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다