I guess they use the contact UID to store the logs (not the number itself).
sqlite3 .local/share/commhistory/commhistory.db select startTime,remoteUid from Events where type = 3;