Querying out 47K rows is taking 4.5-5.5 seconds on my laptop (and its specs 
are nothing special). Not sure how the complexity of my query compares to 
yours but 20-150 seconds seems slow. Heck I can get back over 800K rows in 
about 75 seconds. BTW, running the same queries in SQL Server Management 
Studio is taking basically the same amount of time as in web2py; web2py is 
a tad slower but we're talking fractions to a 10 seconds depending on # of 
records. This is with the MSSQL Express instance running on localhost; 
having to go to a different server would certainly slow things down but I'm 
assuming you're not doing that. You may want to use the Management Studio 
to run the query with Query -> Include Actual Execution Plan and see if it 
suggests any indexes to help speed things up DB side.

Don't know what's is going wrong in your setup.  Perhaps try executing the 
query directly with the appropriate 
pyodbc<https://code.google.com/p/pyodbc/>calls to be sure something in the DAL 
isn't causing the issue? (Though 
that's pretty much what executesql does anyway.) I guess if your 
work-around of breaking the query into smaller chunks and re-combining in 
your code works reliably then I'd just stick with it at this point.

On Monday, November 25, 2013 1:02:57 PM UTC-6, Josh Myers wrote:
>
> @Brian - The minute I sent you the email the problem returned.
>  
> I ran the following code:
>  
> test = db1.executesql('select * from table')
> print test
> print len(test)
>  
> "print test" yields None
>  
> Exception thrown from line "print len(test)":
> "<type 'exceptions.TypeError'> object of type 'NoneType' has no len()"
>  
> Seeing as this JUST worked 10 minutes ago and the time to run has been 
> varying today from 20 up to 150 seconds, I am guessing this is a database 
> issue of some kind.  
>  
> Thanks for your help.  If you have any quick thoughts, then please pass 
> along, but otherwise I do not expect you to spend any more time helping me 
> with my problem as I know you have done a lot for me already.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to