Re: Very slow queries
От | Chad Wagner |
---|---|
Тема | Re: Very slow queries |
Дата | |
Msg-id | 81961ff50701301437t60c5370bvdf165215cbeaeb25@mail.gmail.com обсуждение исходный текст |
Ответ на | Very slow queries (Sidar López Cruz <sidarlopez@hotmail.com>) |
Ответы |
Re: Very slow queries
|
Список | pgsql-performance |
On 1/30/07, Sidar López Cruz <sidarlopez@hotmail.com> wrote:
How many rows exist in salarios, but not in patronos? How many rows are there in salarios?
What does the explain look like for:
delete
from ceroriesgo.salarios s
where not exists (select 1
from ceroriesgo.patronos
where numero_patrono = s.numero_patrono);
Also, is this not a case for a foreign key with a cascade delete?
http://www.postgresql.org/docs/8.2/static/ddl-constraints.html
--
Chad
http://www.postgresqlforums.com/
query: Delete From ceroriesgo.salarios Where numero_patrono Not In (Select
numero_patrono From ceroriesgo.patronos)
Seq Scan on salarios (cost=51021.78..298803854359.95 rows=14240077 width=6)
Filter: (NOT (subplan))
SubPlan
-> Materialize (cost=51021.78..69422.58 rows=1032980 width=25)
-> Seq Scan on patronos (cost=0.00..41917.80 rows=1032980
width=25)
How many rows exist in salarios, but not in patronos? How many rows are there in salarios?
What does the explain look like for:
delete
from ceroriesgo.salarios s
where not exists (select 1
from ceroriesgo.patronos
where numero_patrono = s.numero_patrono);
Also, is this not a case for a foreign key with a cascade delete?
http://www.postgresql.org/docs/8.2/static/ddl-constraints.html
--
Chad
http://www.postgresqlforums.com/
В списке pgsql-performance по дате отправления: