Urgent.News

What's breaking now, across thousands of outlets.

Tech

Learn PostgreSQL extensions through a gloriously bad idea: MM/DD/YYYY

This project teaches four of PostgreSQL's most powerful features by building something no sane person would ship: extensions — how you add new capabilities to PostgreSQL in C, expression indexes — how you index a computed value, not a stored one, custom operators — how you teach PostgreSQL new verbs like <@ and <-> , specialized indexed types — how you invent a data type and the index that makes…

This article explores four powerful features of PostgreSQL by building an application that stores dates as literal ten-character MM/DD/YYYY strings. The goal is to understand how to index and query these dates efficiently.

First, the article explains how to create an expression index using a function that converts the text dates into real dates. This allows queries to use the index efficiently, such as finding all events that happened in September without scanning the entire table.

Next, it discusses how to create a custom type with its own operators, allowing for partial date searches like events that occurred in September regardless of the year. This is achieved by defining a custom type and operators that enable containment queries using the @ symbol.

The article then introduces specialized indexed types, which allow creating a data type and an index that makes it fast to search. In this case, it demonstrates creating a GiST index that can efficiently handle queries based on month, day, and year components of the date.

Finally, it mentions similarity operators, which can be used to perform approximate matching on dates, such as finding the nearest birthdays without scanning the entire table. However, it strongly advises against using the MM/DD/YYYY format in production, as PostgreSQL already has a perfectly good date type that should be used instead.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Why this "Radio"

I recently found myself copying error messages between AI agents that couldn't talk to each other becoming a human API for my own tools.

A 4 GB Laptop GPU Beats a 12-Core CPU by 4.3x on Gemma 4

This article compares two ways of serving the same small language model on the same laptop: CPU-only, and on the 4 GB GTX 1650 Ti sitting in the same chassis.

  • Laptop GPU outperforms 12-core CPU by 4.3x on Gemma 4 model
  • 3.35 GB quantization-aware GGUF model served on both CPU and GPU
  • GPU memory holds 1598 MiB of model's 3.334 GB tensor bytes

Putting Apple's Virtualization framework under a Flutter app

I maintain WSL Manager , a Flutter desktop app from 2021 that saves you from typing wsl.exe flags. Version 2 runs the same app on Apple silicon, where it manages native Linux and macOS VMs through…

  • WSL Manager is a Flutter app released in 2021 for managing WSL environments.
  • Version 2 adds support for Apple silicon devices via Apple's Virtualization framework.
  • vmctl CLI communicates with Flutter app through JSON output for VM management.

More from Wednesday 16 September →