duplicate, answered
on https://groups.google.com/d/msg/web2py/aIg2t3ZlyKY/dnU5YYOPAAAJ
On Tuesday, May 24, 2016 at 10:42:34 PM UTC+2, Matt Bee wrote:
>
> I have a table with a huge amount of records. There are aprox 3*10^6
> registers and counting.
>
> I need via scheduler delete the older registers, but the criteria of old
> register is determined by a datetime field:
>
> db.define_table('foo',
> Field('foo_file', 'upload', required=True, notnull=True,
> autodelete=True, uploadseparate=True),
> Field('foo_date', 'datetime', notnull=True))
>
> Unfortunately there is no relation between id and date (the user/system
> could put data older than the current date).
>
> The system has a controller which shows the lasts 10 registers with the
> indicated criteria. But the query takes too much time, more than 7
> seconds just the query. I have also a periodically task archiving the
> older registers.
>
> rows = db().select( orderby=~db.foo.foo_date, limitby=(0, 10))
>
> I need a way in the DAL for indicating the foo_time datefile field
> should be indexed or similar in order to get fastest queries! :/ I am
> using mysql.
>
> Thanks in advance.
>
> --
> .::MAbeeTT::.
>
> mabeett [at] gmail [ dot] com
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.