From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-admin@lists.postgresql.org
Subject: Re: using regular expression queries with regular expression indexes
Date: Thu, 25 Jun 2020 20:17:47 +0200
Message-ID: <fe5ba8cb-4d5a-8ed5-cda2-6cad27a9bf0c@gmx.net> (raw)
In-Reply-To: <CADyzmyykegZ3ZSVm9hYYKirJYGUYYAx_cK1VQYPCz1q+EpQ89g@mail.gmail.com>
References: <CADyzmyykegZ3ZSVm9hYYKirJYGUYYAx_cK1VQYPCz1q+EpQ89g@mail.gmail.com>
Mark Steben schrieb am 25.06.2020 um 18:45:
> I have a query that uses regexp code to confirm if a text field is a date or not.
Why don't you define it as a date column? (e.g. so that leap years are corretly dealt with)
But if you can't do that, what about a generated column that uses that regex to populate a boolean flag, e.g. is_valid_date?
Then the expensive regex evaluation would only be done when you change the value, not everytime you query it.
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: shammat@gmx.net, pgsql-admin@lists.postgresql.org
Subject: Re: using regular expression queries with regular expression indexes
In-Reply-To: <fe5ba8cb-4d5a-8ed5-cda2-6cad27a9bf0c@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox