# pg\_tre

Published articles for pg\_tre.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## New things for regular expressions in PostgreSQL (pg\_tre and pg\_re2)

DevFeed: [New things for regular expressions in PostgreSQL (pg\_tre and pg\_re2)](<https://devfeed.tech/articles/new-things-for-regular-expressions-in-postgresql-pg-tre-and-pg-re2-33694.md>)

Original publisher: [Read original article](<https://www.depesz.com/2026/08/25/new-things-for-regular-expressions-in-postgresql-pg_tre-and-pg_re2/>)

Author: depesz

Published: 2026-08-25T18:41:53Z

Content type: tutorial

Language: en

Sources: [select \* from depesz;](<https://devfeed.tech/sources/select-from-depesz.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [expression](<https://devfeed.tech/tags/expression.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [pg-re2](<https://devfeed.tech/tags/pg-re2.md>), [pg-tre](<https://devfeed.tech/tags/pg-tre.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [re2](<https://devfeed.tech/tags/re2.md>), [regexp](<https://devfeed.tech/tags/regexp.md>), [regular](<https://devfeed.tech/tags/regular.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [test-data](<https://devfeed.tech/tags/test-data.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>)

### AI overview

This article compares PostgreSQL regular-expression approaches using pg_tre and pg_re2 against built-in matching and pg_trgm. Tests on a large table of query plans find that pg_tre is slower than pg_trgm for exact substring searches but supports fuzzy matching, while pg_re2 performs faster than the tested built-in scan. The author notes that both extensions have limitations and rough edges.

### Source excerpt

Well, truth be told these are not all that new (couple of months), but I finally have gotten around to research it. So, let's see what's what. For starters I need some test data. Luckily, I have explain.depesz.com DB... Extracted all plans to side table, with this structure: =$ \d all_plans Table "public.all_plans" Column | ... Continue reading "New things for regular expressions in PostgreSQL (pg_tre and pg_re2)"