šŸ’¾ Archived View for splint.rs ā€ŗ infinite_posttgres.gmi captured on 2024-05-26 at 15:09:18. Gemini links have been rewritten to link to archived content

View Raw

More Information

ā¬…ļø Previous capture (2023-06-14)

āž”ļø Next capture (2024-07-09)

šŸš§ View Differences

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

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 Ā¼ 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.