Sound like you're looping all the records to connect different table.
I use join for the purpose and working fine though I only have about
10000 records.

http://www.web2py.com/books/default/chapter/29/6?search=join#Inner-joins


On Feb 9, 8:19 am, Sonal_b <[email protected]> wrote:
> I have to query 3 tables which contains large number of data
>
> I have to come up with report which displays
>
> Employee Firstname, Lastname, Manager's FirstName, Manager's Lastname
> and Organisation name.
>
> Table Structure/Details:
>
> 1. Employee table: which contains employee information(First name,
> lastname), Organisation id and manager's id.
> 2. Manager Table: Which contains firstname, lastname etc.
> 3. Organisation table: which contains organisation's name.
>
> The process i follow is:
> 1. Fetch all the employees
>    1.a for each employee get the manager id
>        1.b  For the manager id get the manager's firstname and
> lastname by querying the Manager table
>     1.c for each employee get the organisation id
>      1.d For each organisation id get the Organisation name by
> querying the Organisation table.
>
> When I try to fetch the records from 3 tables following the above
> approach, I get deadlineexceedederror as my request could not complete
> in 30 seconds time.
>
> Please suggest a better way to do this. Also what should i use which
> can improve performance and also get me the result in the 30 second
> timeframe.

Reply via email to