Hi, just a guess: Counting is slow, since it needs to check all rows. Explained here: http://wiki.postgresql.org/wiki/Slow_Counting Thomas GÃttler Tim Uckun wrote: > I have two tables. Table C has about 300K records in it. Table E has > about a million records in it. Today I tried to run this query. > > update C > set result_count = X.result_count > from C > inner join (select c_id, count(c_id) as result_count > from E > where c_id is not null > group by c_id) as X > on C.id = X.c_id > > All the fields mentioned are indexed. In the case of Table C it's the > primary key. In the case table E it's just an index (non unique). > > I let this query run for about three hours before I cancelled it. > ... -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general