I'm trying to figure out the best approach for doing this query. I have a list of action items, typically about 50, that I need to display. Each action item will have two related sets of child items (two different groups of people). So I need to query three main databases, a parent and two children.

One obvious approach would be to query the action items and then run two queries for each action item to pull the two separate related child items. Then just join then in php for output. But that would always mean 2*actions+1 queries every time the page would be viewed. That's a lot of database connections.

Another approach is to use a join query on the parent and one child. Then run a query for each action to pull the other child data. Again joining the data together in php for output. But this means a lot of redundant parent data due to the one to many join.

I'm sure there would be a third approach to do it all in one query with lots of redundant data, but I haven't sat down with my brain yet (it's out to lunch) to talk about that approach. I'm thinking this one may be the best for performance even though a lot more data would need to be transfered.

Any other ideas or suggestions on optimizing these approaches? Thanks.

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to