Don't do a subquery in a subquery in a subquery.
This was there as a workaround for #1, but that has subsequently been fixed. Thus, the hack is no longer required. Also removed an additional `AND` because it is already performed in the `JOIN`. I supsect this last one would've been eliminated by the sqlite optimizer anyway, but the query is slightly simpler now. This fix doesn't improve performance as much as I'd hoped, but it is something.
This commit is contained in:
parent
7a880fdc33
commit
ab248525e0
@ -1057,20 +1057,7 @@ public class AppProvider extends FDroidProvider {
|
||||
" JOIN " + repo + " ON (" + repo + "._id = " + apk + ".repo) " +
|
||||
" WHERE " +
|
||||
app + ".id = " + apk + ".id AND " +
|
||||
apk + ".vercode = ( " +
|
||||
|
||||
// We only want the latest apk here. Ideally, we should
|
||||
// instead join onto apk.suggestedVercode, but as per
|
||||
// https://gitlab.com/fdroid/fdroidclient/issues/1 there
|
||||
// may be some situations where suggestedVercode isn't
|
||||
// set.
|
||||
// TODO: If we can guarantee that suggestedVercode is set,
|
||||
// then join onto that instead. This will save from doing
|
||||
// a futher sub query for each app.
|
||||
" SELECT MAX(inner_apk.vercode) " +
|
||||
" FROM " + apk + " as inner_apk " +
|
||||
" WHERE inner_apk.id = " + apk + ".id ) " +
|
||||
" AND " + apk + ".repo = fdroid_repo._id ";
|
||||
apk + ".vercode = " + app + ".suggestedVercode ";
|
||||
|
||||
return
|
||||
" UPDATE " + app + " SET " +
|
||||
|
Loading…
x
Reference in New Issue
Block a user