나는 다음과 같은 PostgreSQL의 테이블이 : 나는 다음과 같은 명령으로이 테이블을 갱신PostgreSQL을 업데이트 명령이 너무 느립니다
CREATE TABLE "initialTable" (
"paramIDFKey" integer,
"featAIDFKey" integer,
"featBIDFKey" integer,
"featAPresent" boolean,
"featBPresent" boolean,
"dataID" text
);
을 : 당신이, 내가 각각에 대한 dataID를 업데이트하고 볼 수 있듯이
UPDATE "initalTable"
SET "dataID" = "dataID" || '#' || 'NEWDATA'
where
"paramIDFKey" = parameterID
and "featAIDFKey" = featAIDFKey
and "featBIDFKey" = featBIDFKey
and "featAPresent" = featAPresent
and "featBPresent" = featBPresent
열. 이 업데이트는 추가로 작동합니다. 이전 데이터에 새 데이터를 추가합니다.
너무 느립니다. 특히 "dataID"열이 커지면.
다음이다 "설명"결과 :
"Bitmap Heap Scan on "Inexact2Comb" (cost=4.27..8.29 rows=1 width=974) (actual time=0.621..0.675 rows=1 loops=1)"
" Recheck Cond: (("paramIDFKey" = 53) AND ("featAIDFKey" = 0) AND ("featBIDFKey" = 95))"
" Filter: ("featAPresent" AND (NOT "featBPresent"))"
" -> Bitmap Index Scan on "InexactIndex" (cost=0.00..4.27 rows=1 width=0) (actual time=0.026..0.026 rows=1 loops=1)"
" Index Cond: (("paramIDFKey" = 53) AND ("featAIDFKey" = 0) AND ("featBIDFKey" = 95) AND ("featAPresent" = true) AND ("featBPresent" = false))"
"Total runtime: 13.780 ms"
및 버전 : 어떤 제안이
"PostgreSQL 8.4.14, compiled by Visual C++ build 1400, 32-bit"
거기를
"Bitmap Heap Scan on "initialTable" (cost=4.27..8.29 rows=1 width=974)"
" Recheck Cond: (("paramIDFKey" = 53) AND ("featAIDFKey" = 0) AND ("featBIDFKey" = 95))"
" Filter: ("featAPresent" AND (NOT "featBPresent"))"
" -> Bitmap Index Scan on "InexactIndex" (cost=0.00..4.27 rows=1 width=0)"
" Index Cond: (("paramIDFKey" = 53) AND ("featAIDFKey" = 0) AND ("featBIDFKey" = 95) AND ("featAPresent" = true) AND ("featBPresent" = false))"
분석 설명?
http://stackoverflow.com/tags/postgresql-performance/info ... 및 전체 *'update' 문에 따라 'explain analyze'등을 추가하십시오. –
설명을 추가했습니다. – Bipario
'explain ANALYZE'를 추가하십시오. planner가 기대하는 것 이외에 실제 일어나고있는 것을 볼 수 있습니다. Craig가 인용 한 페이지에서 요청 된 나머지 정보도 도움이됩니다. – kgrittn