MAbeeTT
unread,May 24, 2016, 4:42:35 PM5/24/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
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 olders, bit the criteria of old
register is determined by a datetime filed:
db.define_table('foo',
Field('foo_file', 'upload', required=True, notnull=True,
autodelete=True, uploadseparate=True),
Field('foo_date', 'datetime', notnull=True))
Since there there is no relation between id and date (the user/system
could put data older than the current date).
There is a controller which shows the lasts 10 registers with the
indicate 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 indicate that 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