Hi Daniel,
> Now I wanted to delete about 10 million addresses (that are not
> referenced anymore from anywhere), and have a statement like:
What about:
DELETE FROM address
WHERE id IN (
SELECT id FROM address
EXCEPT
(
SELECT address_id FROM tab1
UNION AL
2011/12/19 Marti Raudsepp :
> On Mon, Dec 19, 2011 at 18:14, Pavel Stehule wrote:
>> you can disable check per session if you need
>> ALTER TABLE ... DISABLE TRIGGER ALL;
>
> This is NOT a per-session command, this applies to all connections and
> queries, and may allow incorrect data into the tab
On Mon, Dec 19, 2011 at 18:14, Pavel Stehule wrote:
> you can disable check per session if you need
> ALTER TABLE ... DISABLE TRIGGER ALL;
This is NOT a per-session command, this applies to all connections and
queries, and may allow incorrect data into the table. Don't do this!
(And it doesn't ad
Hello
2011/12/19 Daniel Migowski :
> Hi,
>
>
>
> I face the following problem: I have a large table with 12 million
> addresses, referenced by 20 other tables (some containing about one million
> entries). There are indexes on the foreign keys.
>
>
>
> Now I wanted to delete about 10 million addre
On Tue, Dec 20, 2011 at 3:01 AM, Daniel Migowski wrote:
> DELETE FROM address
>
> WHERE id NOT IN (SELECT address_id FROM bank where address_id IS NOT NULL)
>
> AND id NOT IN (SELECT poboxaddress_id FROM bank where poboxaddress_id IS
> NOT NULL)
>
> AND id NOT IN (SELECT address_id FROM bank
Hi,
I face the following problem: I have a large table with 12 million addresses,
referenced by 20 other tables (some containing about one million entries).
There are indexes on the foreign keys.
Now I wanted to delete about 10 million addresses (that are not referenced
anymore from anywhere),