Hi there,

I am trying to run more complex searches on a database and the user
keeps timing out.

I think the reason this is happening is because the tables the
searches are examining too large a group of rows.

I tried using subselect and exists to do sub select queries.

Could you advise if you can see any issue / fix with the queries i
have recently been making?

an example of the query i am wanting to make is the following:

select distinct(e.id) from table1 e , table2 es1 , table2 es2 , table2
 es3 , table2  es4 , table2  es5 where 1 and e.first_name != '' and
e.last_name != '' and es1.employee_id = e.id and es1.skill = 'Forklift
Driver' and es2.employee_id = e.id and es2.skill = 'Arc Welder' and
es3.employee_id = e.id and es3.skill = 'Blender' and es4.employee_id =
e.id and es4.skill = 'Charge Hand' and es5.employee_id = e.id and
es5.skill = 'Assembly Work' order by e.last_name,e.first_name

however this query examines too many rows so am needing to use
subselect or something more efficient...

table1 has 6000 rows and a size of: 6.3 MB
table 2 has 52000 rows and a size of 2.2MB

table2 stores attributes of items in table 1 and items in table1 can
have more than one attribute in table 2.

thanks for your assistance.

cheers
Brendan.

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to