The fix for 100% CPU while searching in Collection Browser

Gonzalo Alvarez Flores gonzaloaf at gmail.com
Sun Mar 9 16:34:21 UTC 2008


Dr. Diesel wrote:
> Here is a very minor change to collectiondb.cpp, I believe it is a
> valid change.  I've been using it for a while now with no issues.
> Please consider stuffing it into the stable trunk.
>
> Function starting at line 2484, current SVN.  The only change was the
> addition of DISTINCT to each query.
>
> QStringList
> CollectionDB::albumListOfArtist( const QString &artist, bool
> withUnknown, bool withCompilations )
> {
>     if (getDbConnectionType() == DbConnection::postgresql)
>     {
>         return query( "SELECT DISTINCT album.name, lower( album.name )
> AS __discard FROM tags, album, artist WHERE "
>                       "tags.album = album.id AND tags.artist = artist.id "
>                       "AND lower(artist.name) = lower('" +
> escapeString( artist ) + "') " +
>                       ( withUnknown ? QString::null : "AND album.name
> <> '' " ) +
>                       ( withCompilations ? QString::null : "AND
> tags.sampler = " + boolF() ) + deviceidSelection() +
>                       " ORDER BY lower( album.name );" );
>     }
>     // mysql is case insensitive and lower() is very slow
>     else if (getDbConnectionType() == DbConnection::mysql)
>     {
>         return query( "SELECT DISTINCT album.name FROM tags, album,
> artist WHERE "
>                       "tags.album = album.id AND tags.artist = artist.id "
>                       "AND artist.name = '" + escapeString( artist ) + "' " +
>                       ( withUnknown ? QString::null : "AND album.name
> <> '' " ) +
>                       ( withCompilations ? QString::null : "AND
> tags.sampler = " + boolF() ) + deviceidSelection() +
>                       " ORDER BY album.name;" );
>     }
>     else // sqlite
>     {
>         return query( "SELECT DISTINCT album.name FROM tags, album,
> artist WHERE "
>                       "tags.album = album.id AND tags.artist = artist.id "
>                       "AND lower(artist.name) = lower('" +
> escapeString( artist ) + "') " +
>                       ( withUnknown ? QString::null : "AND album.name
> <> '' " ) +
>                       ( withCompilations ? QString::null : "AND
> tags.sampler = " + boolF() ) + deviceidSelection() +
>                       " ORDER BY lower( album.name );" );
>     }
> }
>
> Thanks
> Andy
>
>   

Hello, I 've used the Andy's fix and my amarok is working very well now, 
I've been suffering months ago for the freezes of my amarok, I'm glad 
that finally I can enjoy my music by amarok.

Thanks guys!

-- 
________________________________________________________________________
Follow the white rabbit....     .        .	GNU/Linux User #397758
Gonzalo Alvarez Flores          .        .	 GPG Key 0xB68DA2AB




More information about the Amarok mailing list