Hi All, I have a poor performance SQL as following. The table has about 200M records, each employee have average 100 records. The query lasts about 3 hours. All I want is to update the flag for highest version of each client's record. Any suggestion is welcome! Thanks, Mike ====SQL=========== update empTbl A set flag=1 where rec_ver = ( select max(rec_ver) from empTbl where empNo = A.empNo) ===Table empTbl===== empTbl { int empNo; int flag; char[256] empDesc; int rec_ver; } -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance