home of the madduck/ blog/ 2009.08.11:speed-up-dpkg-on-older-systems/
discussion

I sped up dpkg quite a bit with the following commands:

sudo su -
cd /var/lib/dpkg
tar cvzf info.tar.gz info
rm -rf info
tar xvzpf info.tar.gz
rm info.tar.gz

Basically, by archiving up everything in that folder, deleting it, and writing it again, it defragmented that folder. dpkg is now many times faster.