Skip to Content
0
Former Member
Jun 14, 2009 at 10:10 PM

Select lines from DB where keys not already selected

27 Views

This must have been asked many times, but I haven't been able to find an answer:

How do I best select a large number of entries from a table X where the keys of X

are not already cached in a (also large) internal table t?

There are three possibilities I can think of, one of which doesn't actually work, although

I think it should.

1. Convert t to a range table, where all entries have the form sign=E option=EQ (or

sign=I option=NE - I'm confused about the difference in meaning. Which is right?)

2. Use "for all entries". The documentation of FAE leads me to believe that this

should be possible, because the docs only talk of using logical expressions in general

with FAE, not equality specifically. However, using inequality does not give the right result,

i. e.

select * from X for all entries in t where k NE t-k

does not work. Am I missing something?

3. Do a select loop and read t before accepting a line. Although t is a hash table, this is

probably the worst as regards performance.

-- Sebastian