Hello,
I’m using a zip_employee table (33k records) defining per zip-code range (zipfrom, zipto) the employee who is responsible for this area, something like this:
CREATE TABLE zip_emp
( zipfrom
char(10) NOT NULL,
zipto
char(10) NOT NULL,
empid
CHAR(10) NOT NULL
PRIMARY KEY (zipfrom
,zipto
)
);
When I’m executing a simple query like the one beneath, the performance is very, very slow:
select sta.statid, zip.empid
from statistics
sta,
zip_emp
zip
where sta.zip between zip.zipfrom and zip.zipto
Can someone tell me why a query using a from-to join is so slow (a “normal” query is very fast) and what is the alternative?
Thanks,
Menrone