Subject Full join unusably slow
Author Mark Patterson
Hi,

I was trying to add a field to indicate whether the user had selected a field or
not. To make it transient and not takeup space in the table I added a table
sm_selected with one field called id. The presence of value in sm_selected means
that the corresponding record in sawmembers has been selected by the user and is
hightlighted on his screen.

The join query:
select auto_number, id, station_id from sawmembers
full join sm_selected on id = auto_number
where status < 3
order by station_id

takes 100 s and returns, 38343 records

The old-style query:
select auto_number, station_id from sawmembers
where status < 3
order by station_id

took 5 seconds

select count(*) from sawmembers gives 426767

The script to create the sm_selected table is:

CREATE TABLE SM_SELECTED (
ID INTEGER NOT NULL PRIMARY KEY
)

Any ideas about getting the speed back? I don't see a fundamental reason for it
to take so long. It must be doing things in the wrong order.

TIA,

Mark

Regar