💾 Archived View for malinfreeborn.com › gen › infinite_posttgres.gmi captured on 2022-04-29 at 11:25:43. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Infinite Postgres

Someone with the misfortune to be my friend asked about a theoretical infinite database which hard a year's worth of records, and how you could make a query easy by jumping a certain amount here, and caching there. What he meant was 'a very big database', but the cat was out of the bag, and he got the lecture on how jumping a month would still take an infinite amount of time, because 1/12th of infinity would still take an infinite amount of time.

This got me thinking - how would you deal with an infinitely large database? Specifically, let's imagine an infinite database with records spanning a single year, and you want to retreive all entries from a particular day. If the records were evenly spaced, you could request, e.g., the records of March 15th.

We start by asking for the records from 3/12ths along the set (or 1/4 along), till 4/12ths (or 1/3rd). This gives us the records for March. Then we request the record for half-way between those points, which would be the 15th.

If we look at the records there, we find an infinite number, so we cannot actually see any events in March, or at least cannot locate a particular one, becaause all searches contain an infinite number of results. However, we have indeed obtained all the results for that day.

This is all with the assumption that the records are uniformly spread. But what if they're not? What if January has an infinite number of entries, but February has a finite number, then March has an infinite number, and so on, with every even month containing a finite number, and every odd-numbered month containing an infinite number of records?

At this point, things look dicey. If you add the total number of entries totgether, you'll find that infinity plus infiniity equals infinity, so going half-way along the series lands you at the end of March, with no possibility of reaching February. If March didn't have 31 days, but was evenly spread, so that our infinite series ran exactly along the half-way point, then I'm not sure where exactly one would land. I suppose it depends on whether you're using postgresql or SQL.