Welcome Guest, Not a member yet? Register   Sign In
Page takes a long time to load
#1

[eluser]Zac G.[/eluser]
Hi folks,

I have a page that returns a table with about 2000 records and it is taking a long time to load (a few seconds).

I am wondering if that is standard, or if I need to look at optimizing my queries. I know this is a tough question to answer without posting up all the queries, but if you have any general feedback it would be appreciated.

Cheers,
Zac
#2

[eluser]TheFuzzy0ne[/eluser]
Enable the profiler and then you can see where the bottlenecks are, be it processing or queries. If it's the processing, then you'll need to add some benchmarks to locate the bottleneck.
#3

[eluser]n0xie[/eluser]
If you're using MySQL you can use EXPLAIN to get info about bottlenecks in your query.
http://dev.mysql.com/doc/refman/5.0/en/explain.html
#4

[eluser]Zac G.[/eluser]
@TheFuzzyOne, when I enable the profiler I get a fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16777919 bytes) ...

Thanks n0xie, I am going to look into MySQL EXPLAIN now too Smile
#5

[eluser]Dam1an[/eluser]
The above comments are valid, but I can't help but wonder if you really need to return 2000 rows at a time?
Would maybe returning 100 at a time (using limit/offset) and pagination not work better? Less information to take in for the end user, and less stuff for you to handle (in terms of data volume)
#6

[eluser]TheFuzzy0ne[/eluser]
For debugging purposes it may pay you to up the memory_limit for the duration of your debugging session. Another way that this might work is if you use the SQL resource directly, rather than exporting it all to an array or object.
#7

[eluser]sophistry[/eluser]
i've seen that memory exhausted error when using next_row() and previous_row() CI convenience functions in the db class. you are not using those functions are you?

BTW, it always helps to post a little bit of code and or queries up front because if you have a tough problem people here are going to ask for it eventually anyway...

cheers.




Theme © iAndrew 2016 - Forum software by © MyBB