toenailsin
04-13-2009, 05:46 PM
i'm having trouble getting a count query of a reasonable speed.
i need a count of all clients relating to a member, bearing in mind that a client might be related to a member in any number of ways.
with all conditions in one query, it takes 27 seconds (testing with 150k rows). individual querys i can get it to 1 second, but that doesn't factor in duplicates
basic table layout (omitted groups, clients and members tables. they're unimportant):
client2member
-member_id
-client_id
client2group
-group_id
-client_id
tasks
-member_id
-client_id
i need a count of all clients relating to a member, bearing in mind that a client might be related to a member in any number of ways.
with all conditions in one query, it takes 27 seconds (testing with 150k rows). individual querys i can get it to 1 second, but that doesn't factor in duplicates
basic table layout (omitted groups, clients and members tables. they're unimportant):
client2member
-member_id
-client_id
client2group
-group_id
-client_id
tasks
-member_id
-client_id