Category: Don’t know

UUIDv4 vs. UUIDv7: Why Order Matters for Database Indexes

UUIDv4 and UUIDv7 are both 128-bit identifiers, but they organize their bits differently. UUIDv4 uses random data, while UUIDv7 begins with a millisecond timestamp, followed by random data or optional ordering components. This makes UUIDv7 approximately chronological when sorted.

The main database advantage is better locality in B-tree indexes.

With UUIDv4, new keys land throughout the index. Inserts can touch many different pages, increasing cache misses and disk activity. Splitting full pages can also leave space unevenly utilized.

With UUIDv7, newly generated keys usually land near the end of the index. As a result, inserts repeatedly access a smaller set of pages. This can provide:

  • Better cache efficiency, because recently accessed pages are reused.
  • Less scattered I/O, especially when the index exceeds available memory.
  • Better page utilization and potentially fewer disruptive page splits.

These are workload-dependent benefits, not guaranteed speedups. RFC 9562 explicitly identifies poor database-index locality as a limitation of random UUIDs.

UUIDv7 still occupies 16 bytes and exposes its generation timestamp. It also does not guarantee exact creation order across machines or within the same millisecond.

My projects

Here I want to share some information about my pet projects I am working on right now:

Turn your Google translate dictionary into learning flash cards. The problem is simple – learn words from Google Translate dictionary
https://gtlearn.mcher.dev

Pretty often I use some tools in my daily work, for example, to estimate costs in cloud environment – I want to know size in bytes which one typical information item will take. It is very important if you are working on high load application, like millions requests per day, and every request has at least 400 bytes of payload – gigabytes of storage should be reserved
https://tools.mcher.dev/
https://tools.mcher.dev/stringsizecalc/

base64 encoding, decoding
https://tools.mcher.dev/base64/

password generator
https://tools.mcher.dev/passwordgen/

url parser and builder
https://tools.mcher.dev/urlbuilder/

Turn existing folder into git repository

First of all let me write about initial conditions:

  • I have folder on my computer’s disk with code
  • I have a new empty repository on github

Our great plan consists of following points:

  1. Navigate to project folder:
    • $ cd /path/to/project
  2. Add files to the repository:
    • $ git init
    • $ git add . (don’t forget about point sign)
    • $ git commit -m “first commit”
  3. After we have to connect to our remote repository:
    • $ git remote add origin https://github.com/mygitaccount/mynewproj.git
  4. Push files on remote server and create new branch “master” on our new github repository
    • $ git push -u origin master
  5. Last thing, type the following command:
    • $ git push

Now all your files in github repository, congratulations!
If you want to check current state type
$ git status – it shows active branch, and other useful information.
$ git branch – shows all available branches

Links:
https://git-scm.com/doc
https://wiki.epfl.ch/help-git-en/how-can-i-import-an-existing-folder-into-my-repository

Таймер Табата

Весна 2020. В мире пандемия короновируса, который вызвал кризис, последствия которого никто предсказать не может.

На данный момент жители многих стран вынуждены сидеть дома на карантине / в самоизоляции. Закрыты многие кафе, спортзалы, другие общественные места.

В принципе, в самоизоляции можно найти плюсы. Я например, решил, что не хочу терять физическую форму, находясь дома, поэтому занимаюсь табатой – интенсивными интервальными тренировками.

Более того, я смог с помощью этих тренировок сбросить около 5ти килограмм.

На волне такого успеха (а для меня это успех) я решил написать свой табата-таймер.
В планах:
1. добавить английский язык
2. сохранение тренировок (последовательность упражнений)
3. галерея упражнений
4. мобильное приложение (ууух!)

Сейчас же таймер может быть запущен сразу на один круг, либо можно настроить под свою индивидуальную тренировку

Possible errors with SCRoulette

Few days ago I noticed in statistics of SCRoulette strange URLs, like http://blabla/?err=_err … stuff like that. Obviously, it means that somebody faced with some errors on website. Yes, errors, but why did they appear?

I think, that the only cause of error like that, is the SoundCloud mobile application. And it may appear, when somebody tries to log in using the mobile application. Concrete moment – when browser asks what application do you want to choose to log in:

Choose the application. Android

So, if you whant to log in with mobile app, it seems to me that you’ll not succeed, unfortunatly. Use browser.

P.S. I don’t know how it works with iPhone.

P.P.S. If you found some errors, or you have some ideas about scrouleete, feel free to comment here, on YouTube, Twitter (use #scroulette tag)