Artur, I suggest you need more information about the number of list_id's, item_id's and modified's. Sometimes people use the term CARDINALITY for these counts. So, start with list_id, which is one form of a UUID. The UUID consists of the digits 0 thru 9 and the letters a thru f or A thru F. The hyphen, '-', is merely for human readability. select count(*) from (select distinct list_id from item) ; Repeat for "modified" and "item_ids".