# HG changeset patch # User fabien # Date 1075995977 18000 # Node ID c01d2690b458fa05617c424a77e295d379a8bb57 # Parent cce22ab553d16ff0b0eacb1860a0e7b071d32cdb [svn] Remove the useless ORDER BY from the query for speed improvemennt (Doh!) diff -r cce22ab553d1 -r c01d2690b458 immsview --- a/immsview Thu Feb 05 02:07:38 2004 -0500 +++ b/immsview Thu Feb 05 10:46:17 2004 -0500 @@ -20,9 +20,13 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -_immsview_version = "$Id: immsview 1700 2004-02-05 07:07:38Z fabien $" +_immsview_version = "$Id: immsview 1701 2004-02-05 15:46:17Z fabien $" # $Log$ +# Revision 1.20 2004/02/05 15:46:17 fabien +# Remove the useless ORDER BY from the query for +# speed improvemennt (Doh!) +# # Revision 1.19 2004/02/05 07:07:38 fabien # Add some colors related to the rating. # @@ -194,17 +198,15 @@ def get_ratings_and_info(self, uids = None): print time.ctime(time.time()) + ": querying" cu = self.cx.cursor() - qry = '''SELECT Rating.uid, Rating.rating, - Library.path, Last.last - FROM Rating, Library, Last - WHERE Rating.uid = Library.uid AND - Library.sid = Last.sid ''' + qry = '''SELECT l.uid, r.rating, l.path, ls.last + FROM Library l, Rating r, Last ls + WHERE l.uid = r.uid AND l.sid = ls.sid''' if uids: - qry += 'AND (Library.uid = %d' % (uids.pop()) + qry += ' AND (l.uid = %d' % (uids.pop()) for uid in uids: - qry += ' OR Library.uid = %d' % uid - qry += ') ' - qry += 'ORDER BY Rating.rating DESC;' + qry += ' OR l.uid = %d' % uid + qry += ')' + qry += ';' cu.execute(qry) # Better to fetch everything since locking can really mess # things in imms plugin. @@ -254,7 +256,7 @@ ) self.db = db self.set_default_sort_func(self.default_sort) - self.set_sort_column_id(-1, 0) + self.set_sort_column_id(IMMSStore.COL_RATING, gtk.SORT_DESCENDING) def default_sort(self, a, b, dummy): return 0 def tune_to_giter(self, tune, giter = None): @@ -272,7 +274,7 @@ def refresh(self): col, order = self.get_sort_column_id() if col: - self.set_sort_column_id(-1, 0) + self.set_sort_column_id(-1, gtk.SORT_ASCENDING) tunes = self.db.get_ratings_and_info() self.clear() print time.ctime(time.time()) + ": inserting"