Subject | Re: [ib-support] select etc. |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2003-03-18T11:31:07Z |
At 12:03 18.03.2003 +0100, you wrote:
but the subselect is probably executed once for every row, so you'll notice
that this select will become slower as the number of records in the tables
increases. Generally, doing
SELECT <whatever> FROM MYTABLE1 WHERE NOT EXISTS (SELECT 1 FROM MYTABLE2
WHERE MYTABLE2.<field> = MYTABLE1.<field>)
is a lot quicker.
HTH,
Set
>SELECT * FROM MYTABLE1 WHERE MYTABLE1.MYFIELD1 NOT IN (SELECT MYFIELD1 FROMThis will work fine as long as you only have a few records in each table,
>MYTABLE2)
but the subselect is probably executed once for every row, so you'll notice
that this select will become slower as the number of records in the tables
increases. Generally, doing
SELECT <whatever> FROM MYTABLE1 WHERE NOT EXISTS (SELECT 1 FROM MYTABLE2
WHERE MYTABLE2.<field> = MYTABLE1.<field>)
is a lot quicker.
HTH,
Set