The following query takes 53 seconds to complete when run in pgadmin3
select A.* from
isap A
left join akb_articles B on (B.ltitle = A.ltitle)
where B.title is null
On the web2py commandline I get the same result (107436 records) in 22
seconds:
query = (db.isap.id > 0) & (db.akb_articles.title == None)
left = db.akb_articles.on(db.akb_articles.ltitle == db.isap.ltitle)
l = db(query).select(db.isap.id, db.isap.date, db.isap.article_title,db.
isap.journal_title, db.isap.author,db.isap.vo, db.isap.issue, db.isap.issn,db
.isap.pages,db.isap.yr, left = left)
The first query selects more fields and has to show the result on the
screen, while the query on the commandline did not have to show anything at
this stage. That can possibly explain the timing difference.
But when I did the following which involves a grid, I had to stop the
process after more than 5 minutes and I had problems to kill web2py after
that: it would not react to anything:
def isap_not_in_akb():
left = db.akb_articles.on(db.akb_articles.ltitle == db.isap.ltitle)
query = (db.isap.id > 0) & (db.akb_articles.title == None)
fields = [db.isap.id, db.isap.date, db.isap.article_title,
db.isap.journal_title, db.isap.author,
db.isap.vo, db.isap.issue, db.isap.issn, db.isap.pages,
db.isap.yr]
response.view = 'journal/edit_journal.html'
form = SQLFORM.grid(query, fields = fields, maxtextlength = 100, left =left
)
opskrif = H4(T('ISAP articles'))
return dict(opskrif = opskrif, form = form)
Something is wrong here and I suspect it might be a bug of some sort unless
I am overlooking some serious flaw in my code.
Regards
Johann