Posts

pg_cte_force — Controlling CTE materialization in PostgreSQL

 Starting with PostgreSQL 12 , the behavior of Common Table Expressions (CTEs) changed significantly. Before PostgreSQL 12, CTEs acted as an optimization fence and were always materialized. Since PostgreSQL 12, the planner can inline side-effect-free CTEs when appropriate. By default, a CTE referenced only once can be folded into the parent query, while a CTE referenced multiple times is normally materialized. PostgreSQL also provides the MATERIALIZED and NOT MATERIALIZED clauses to explicitly control this behavior. This is generally a great improvement for query optimization. But what happens when you have to deal with legacy applications ? I often work with applications originally developed for PostgreSQL versions earlier than 12, where queries were written assuming the old CTE behavior. Sometimes things become even more complicated because SQL queries are generated by frameworks or applications that cannot easily be modified to add the MATERIALIZED clause. So I decided to wr...

COME TO CODE 2024

Image
The 2024 edition of come to code took place in Pignola (PZ), a beutiful place near Potenza, and my colleague and friend Stefano De Nardis and I had the honor of participating. This year we presented a talk about provisioning  focused on: Proxmox Cloudinit Vault Terraform Ansible PostgreSQL PgBackRest Zabbix Grafana Minio The goal of the talk was to show how to perform an automatic provisioning for a system installation composed  by: PostgreSQL primary PostgreSQL replica PgBackRest with backups and wals stored on buckets managed locally by Minio Zabbix with PostgreSQL templates already installed Grafana - with a viewer user with read-only permissions on the dashboards Here  below you can find the links to the talk:  Google Drive directory with slides and video showing the system running : link Github repository with all the files used for the presentation: link   Enjoy !!!

TRAPI : a simple python API to make good translations

Image
  TRAPI is an example of how with a few lines of Python code it is possible to create an API for doing translations. TRAPI uses a local model installed on your server; It is based on model takes    https://huggingface.co  . Inside the Python code you can find three example models, but you can find more on the URL written above. # Load model #model_name = 'Helsinki-NLP/opus-mt-tc-big-en-it' # english -> italian model_name = 'Helsinki-NLP/opus-mt-tc-big-en-fr' # english -> french #model_name = 'Helsinki-NLP/opus-mt-tc-big-en-es' # english -> spanish The API is based on flask that handles a form html with some code javascript .  Here below an example  of a translation from a wikipedia article: https://en.wikipedia.org/wiki/Linux The project is available on github:  https://github.com/sscotty71/trapi  Enjoy ;)

My name is Teb, I'm an elephant bot and I live in a docker container :)

Image
  My name is Teb , I'm an elephant bot and I live in a docker container :) This personal project,has been created just for fun. It was born after seeing Chris Mair's talk about Self-Hosted RAG and it is based on stuartbot project by Noi-techpark of Bolzano.

PgTraining : new website is out ;)

Image
  PgTraining - new web site is out -  www.pgtraining.com  ðŸ˜€  #postgresql

Zdevsummit 2024 - PgBackRest

Image
 On March 21st and 22nd I was  at the ZdevSummit made by Zucchetti Hospitality. Here below a photo of my talk about PgBackRest #PostgreSQL #PgBackRest #Zucchetti

PgTraining on line session 2024-04 - italian session

Image
Don’t miss this year’s PgTraining webinar (conducted in Italian)! -  Friday, 19th April, from 15:00 to 18:00 CEST.