Extra SQL calls invoked using paginate...

I am using the paginate helper method to retrieve data from 2 tables.
Here is a sample of what the call looks like:

@paginator, @entries = paginate(:model_name, :include =>
'another_model_name', :conditions => conditions, :per_page =>
method_returns_number(), :order => @var_with_sort_params)

the problem I am having is there are extra SQL calls made after the
data is retrieved in the log... basically, paginate goes off and does
its thing running the queries required for the data, and then last but
not least, it makes a call like this for every record I have in my
page (so 10 records per page - 10 of these calls) to the ':include'
table

2007-12-04 PST 14:59:48 DEBUG: e[4;35;1mSQL (0.004367)e[0m
e[0mSELECT * FROM another_model_table WHERE (another_model_table.[id]
= 643) e[0m

*Obviously I have changed the table names and sensitive information,
but in essence this is my issue...

Why am I getting all these extra calls per row in my page, I don't see
this in similar use of the paginate helper in the application. Has
anyone else run into this?

I have tried several ways to debug, but I am open to suggestions there
too if you don't have a solution.

Thanks.

Matthew Carriere wrote:

I am using the paginate helper method to retrieve data from 2 tables.
Here is a sample of what the call looks like:

@paginator, @entries = paginate(:model_name, :include =>
'another_model_name', :conditions => conditions, :per_page =>
method_returns_number(), :order => @var_with_sort_params)

the problem I am having is there are extra SQL calls made after the
data is retrieved in the log... basically, paginate goes off and does
its thing running the queries required for the data, and then last but
not least, it makes a call like this for every record I have in my
page (so 10 records per page - 10 of these calls) to the ':include'
table

2007-12-04 PST 14:59:48 DEBUG: [4;35;1mSQL (0.004367) [0m
[0mSELECT * FROM another_model_table WHERE (another_model_table.[id]
= 643) [0m
[...]
  
Are you sure this is the call to paginate that creates these queries and not another part of your code (maybe in the view for example)?

Lionel