Add database method for getting amount of data to sync
Subtask of #1802
issue