Jekyll2026-03-13T19:09:00+01:00https://maximeorefice.com/feed.xmlMaxime OreficeHacker, crossfiter, kiffeur, bitcoiner.📦 Repacking2025-09-08T00:00:00+02:002025-09-08T12:24:15+02:00https://maximeorefice.com/2025/09/08/repackingpg-repack

Table Bloat

This week I’ve been dealing with PostgreSQL table bloat issues with some production data. When tables accumulate dead tuples from frequent updates and deletes, they can become severely bloated, impacting query performance.

I explored pg_repack, a powerful extension that reorganizes tables online without holding exclusive locks.

Why pg_repack?

Unlike VACUUM FULL, pg_repack allows concurrent reads and writes during the reorganization process. This makes it perfect for production environments where downtime isn’t an option.

The tool works by creating a new table copy, applying all changes via triggers, and then swapping the tables atomically.

pg_repack removes bloat from tables and indexes, and optionally restores the physical order of clustered indexes.

How to run it?

Note: This was tested on macOS with a local PostgreSQL instance.

First we installed pg_repack using the PostgreSQL Extension Network client:

$ brew install pgxnclient
$ cd /path/to/development-kit
$ pgxn install pg_repack

Then we enabled the extension in our target database:

CREATE EXTENSION IF NOT EXISTS pg_repack;

Finally we ran pg_repack on a specific partitioned table that was experiencing heavy bloat:

$ pg_repack \
  --dbname="postgresql://user:[email protected]:5432/development_db" \
  --table='gitlab_partitions_dynamic.ci_builds' \
  --jobs=4 \
  --no-order \
  --wait-timeout=36000 \
  -w \
  --echo \
  2>&1 | ts '[%Y-%m-%d %H:%M:%S]' | tee -a "pg_repack_ci_builds_$(date +%Y%m%d_%H%M%S).log"

The --echo flag shows all SQL commands being executed, which is helpful for understanding what pg_repack is doing behind the scenes.

The entire repack of our 500GB partition completed in 3 hours, achieving a 30% reduction in table size.

]]>
🇮🇩 Bali2025-08-28T00:00:00+02:002025-08-28T16:46:18+02:00https://maximeorefice.com/2025/08/28/balibali

🚙 Transport

  • Avion: 2 841€

💰 Total:

Manger

🏠 Dormir

💰 Total: 1 225€

A voir

Sortir

Planning

Jour Activité Budget
1 Kuta
2 Ubud
3 Ubud
4 Ubud
5 Ubud
6 Lovina
7 Lovina
8 Lovina
9 Lovina
10 Ahmed
11 Ahmed
12 Ahmed
13 Jimbarran
14 Jimbarran
15 Jimbarran
16 Sanur

💰 Total:

💰 Budget

Type Budget
Transport 2 841€
Logement 1 225€
Activité
Total ~4 066€

Liens

]]>
🇵🇹 Madère2024-06-26T00:00:00+02:002024-08-08T15:15:31+02:00https://maximeorefice.com/2024/06/26/maderemadere

🚙 Transport

  • Parking: 148€
  • Avion: 485€
  • Location voiture: 357€

💰 Total: 990€

Manger

🏠 Dormir

💰 Total: 735€

A voir

Sortir

Planning

Jour Activité Budget
1 Arrivé
2  
3  
4  
5  
6  
7  
8 Départ 0€

💰 Total:

💰 Budget

Type Budget
Transport 990€
Logement 735€
Activité
Total ~€

Liens

]]>
🤖 AI Embedding2024-06-24T00:00:00+02:002024-06-25T14:44:59+02:00https://maximeorefice.com/2024/06/24/ai-embeddingai-embedding

Hackathon

This week I have been playing around with AI models from Anthropic and Vertex AI at GitLab to familiarize myself with this new technology.

I have learned a lot of new skills and discovered how powerful those recents models are.

Detecting duplicate content

We have been working on a small project in order to identify when an issue contains the same information.

The idea was to convert the content of an issue an generating an embedding for it.

This technique is being called Semantic Similarity.

An embedding is a compressed numerical representation of a piece of text that captures its meaning and is generated by an ML model.

How we did it?

Note: The code is available here.

First we installed pgvector, a new postgres extension in order to store those records in our database:

$ brew install pgvector
CREATE EXTENSION vector;

Then we added a new column to persist those records in the issue table:

ALTER TABLE issues ADD COLUMN embedding vector(768);

And a new index to speed up the queries:

CREATE INDEX ON issues USING hnsw (embedding vector_l2_ops);

Finally we ran a script to import all existing issues for a given team and generating embedding for it.

To determine how similar an issue is with another one we leveraged the neighboor gem to measure the euclidean distance between those vectors:

nearest_issue = issue.nearest_neighbors(:embedding, distance: "euclidean").first
nearest_issue.neighbor_distance
=> 0.6025755637811935

This gives us a great approximation of how similar an issue with the rest of them and we need to adjust the distance to determine good threshold with our entire dataset.

For our use case, a distance of 0.3 gave us a good approximation of similar issues.

]]>
🤿 Plongee2024-06-11T00:00:00+02:002024-07-28T08:14:12+02:00https://maximeorefice.com/2024/06/11/plongeeplongee

Padi

  • 18m avec un instructeur
  • Certifat medical
  • A 20m la pression est de 3bar
  • Palier de securité à 5m
  • Equilibré par palier
  • Gérer sa flottabilité
  • Connaître les signes
  • Avoir au minimum 50 bars/500 psi restants
  • Sortir de l’eau: flotabilite positive -> enlever palme -> garder masque et respirer sur tuba
  • Toujours coucher la bouteille
  • L’eau est environ 800 fois plus dense que l’air
  • Le son se déplace environ quatre fois plus vite dans l’eau que dans l’air
  • L’hydrodynamisme est simplement le processus consistant à porter son matériel près de soi
  • L’eau absorbe davantage de chaleur que l’air à la même température et 20 fois plus vite.
  • Contrôle de sécurité pré-plongée BALLO = Bouée; Air; Lestage; Largage; OK.
  • Gérer sa réserve d’air
  • Descente en 5 etapes
  • Un palier de sécurité est un arrêt de trois à cinq minutes fait entre 6 mètres/20 pieds et 6 mètres/20 pieds, 3 mètres/10 pieds.
  • Toujours porter un object tranchant sur soi pour des raisons de sécurité
  • Le ressac ou la zone de ressac est l’endroit où les vagues se brisent.
  • Les courants d’arrachement se produisent quand les vagues font passer l’eau au-dessus d’une longue obstruction (comme un banc de sable ou un récif).
  • Planification préalable > Planification préparatoire > Planification de pré-plongée > Préparatifs de dernière minute
  • Enregistrer ses plongées (elogs)
  • Air = 21% Oxygène + 79% Azote

Deroulement

Exercice Prix
Elearning 210€
Plongées 420€

Log Book

Lieu Temps Profondeur
Lion de mer 37min 6m
Lion de mer 47min 13m
Lion de mer 47min 20m
Pyramide 46min 20m
Sec de Suisse 41min 20m
La roche Percé 46min 20m

Liens

]]>
🇨🇭 Suisse2024-02-16T00:00:00+01:002024-09-30T16:03:09+02:00https://maximeorefice.com/2024/02/16/suisseswitzerland

Lausanne

Manger

Resto

Café/Snack

Vevey

Bern

Valais

Rando

]]>
🇹🇷 Istanbul2023-10-08T00:00:00+02:002024-02-18T08:57:28+01:00https://maximeorefice.com/2023/10/08/istanbulistanbul

🚙 Transport

💰 Total:

Manger

🏠 Dormir

💰 Total:

A voir / A faire

Planning

Jour Activité Budget
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  

💰 Total:

💰 Budget

Type Budget
Transport
Logement
Activité
Total ~€

Liens

]]>
🇺🇸 USA West Coast2023-10-03T00:00:00+02:002024-05-08T15:47:35+02:00https://maximeorefice.com/2023/10/03/usa-west-coastwestcoast

✈️ Transport

💰 Total: $2769

  • Max: $0
  • Mil: $1050
  • Marco: $119

  • Car (16 days): $1764

🏠 Dormir

💰 Total: $2541

A voir / A faire

Planning

Jour Activité Budget Rando
1 Las Vegas -> Zion $ The watchman trail
2 Zion -> Bryce Canyon -> Lake Powell $ Navajo Loop
3 Lake Powell -> Horseshoe Bend -> Antelope Canyon -> Grand Canyon $ Horseshoe bend trail
4 Grand Canyon $ Avion, Rim trail
5 Grand Canyon -> Death Valley $  
6 Death Valley $ Red Cathedral, Dante view
7 Death Valley -> Sequoia Park $  
8 Sequoia Park $ Sherman Tree
9 Sequoia Park -> San Francisco $  
10 San Francisco $  
11 San Francisco $  
12 San Francisco $  
13 San Francisco -> Los Angeles $  
14 Los Angeles $  
15 Los Angeles $  
16 Los Angeles -> Paris $  

💰 Total: $

💰 Budget

Type Budget
Transport $2803
Logement $2541
Activité $
Total ~$5344

Liens

]]>
🏝️ Corsica2023-05-23T00:00:00+02:002024-02-17T22:18:39+01:00https://maximeorefice.com/2023/05/23/corsicacorsica

🚙 Transport

  • Avion: 275€
  • Voiture: 190€

💰 Total: 370€

Manger

🏠 Dormir

💰 Total: 220€

A voir / A faire

Planning

Jour Activité Budget
1 Ajaccio 30€
2 Porticcio 30€
3 Porticcio 30€
4 Porticcio 30€
5 Porticcio 30€
6 Porticcio 30€
7 Sotta 30€
8 Porto-Vecchio 50€
9 Bonifacio 50€
10 Sartene, Propriano 50€
11 Ajaccio 50€

💰 Total: 600€

💰 Budget

Type Budget
Transport 100€
Logement 220€
Activité 300€
Total ~620€

Liens

]]>
🇮🇹 Milano2023-03-22T00:00:00+01:002024-02-17T22:07:10+01:00https://maximeorefice.com/2023/03/22/milanobitcoin

🚙 Transport

💰 Total: 100€

Manger

🏠 Dormir

💰 Total: 110€/nuit

A voir / A faire

Planning

Jour Activité Budget
1 Milan 150€
2 Milan 150€
3 Milan 50€

💰 Total: 600€

💰 Budget

Type Budget
Transport 100€
Logement 220€
Activité 300€
Total ~620€

Liens

]]>