Sabio - PSQL wrote:
How can I improve speed on my queries. For example this query takes
one day executing itself and it has not finalized !!!
"create table tmp_partes as select * from partes where identificacion
not in (select cedula from sujetos)"
partes have 1888000 rows, an index on identificacion
sujetos have 5500000 rows, an index on cedula
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
try create table tmp_partes as select * from partes where not exists
(select cedula from sujetos where cedula = partes.identificacion);
The "not in (subselect)" is very slow in postgresql.
HTH,
chris
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match