Serialisation only works (properly) if you only have to get the preferences for a given user. If the other way around is also required, serialisation is not a good idea. The search query https://github.com/owncloud/apps/pull/1718/files#diff-39091b229a558037dc65a21da68af5c7R299 looks rather bad performance wise, using LIKE and OR.