diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index 23784a5..41a3be5 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -29,6 +29,7 @@
 using System;
 using System.Data;
 using System.Reflection;
+using System.Text;
 using System.Threading;
 using Mono.Unix;
 
@@ -628,14 +629,31 @@ namespace Banshee.Database
         private bool Migrate_27 ()
         {
             // One time fixup to MetadataHash now that our unknown metadata is handled properly
-            var tracks_needing_new_hash = DatabaseTrackInfo.Provider.FetchAllMatching (
-                "(CoreTracks.Title IS NULL OR CoreArtists.Name IS NULL OR CoreAlbums.Title IS NULL)"
-            );
-
-            var cmd = new HyenaSqliteCommand ("UPDATE CoreTracks SET MetadataHash = ? WHERE TrackID = ?");
-
-            foreach (DatabaseTrackInfo track in tracks_needing_new_hash) {
-                connection.Execute (cmd, track.MetadataHash, track.TrackId);
+            const string sql_select = @"
+                SELECT t.TrackID, al.Title AS AlbumTitle, ar.Name AS ArtistName, t.Duration,
+                t.Genre, t.Title AS TrackTitle, t.TrackNumber, t.Year
+                FROM CoreTracks AS t
+                JOIN CoreAlbums AS al ON al.AlbumID=t.AlbumID
+                JOIN CoreArtists AS ar ON ar.ArtistID=t.ArtistID
+                WHERE t.Title IS NULL OR ar.Name IS NULL OR al.Title IS NULL
+            ";
+            const string sql_update = @"
+                UPDATE CoreTracks SET MetadataHash = ? WHERE TrackID = ?
+            ";
+            StringBuilder sb = new StringBuilder ();
+            using (var reader = connection.Query (sql_select)) {
+                while (reader.Read ()) {
+                    sb.Length = 0;
+                    sb.Append ((string)reader["AlbumTitle"]);
+                    sb.Append ((string)reader["ArtistName"]);
+                    sb.Append ((int)TimeSpan.FromMilliseconds ((long)reader["Duration"]).TotalSeconds);
+                    sb.Append ((string)reader["Genre"]);
+                    sb.Append ((string)reader["TrackTitle"]);
+                    sb.Append ((int)(long)reader["TrackNumber"]);
+                    sb.Append ((int)(long)reader["Year"]);
+                    string hash = Hyena.CryptoUtil.Md5Encode (sb.ToString (), System.Text.Encoding.UTF8);
+                    connection.Execute (sql_update, hash, (long)reader["TrackID"]);
+                }
             }
 
             return true;
