Using a regex here is not a wise decision, even with proper delimiters (which are dangerously lacking).
If destructing¹ the hash is fine I'd try delete @kws{@kwlist} (see delete and hash slice) and calculate the difference of scalar keys %kws before and after.
But - as you already mentioned- I suppose PG has already a built-in hash slice feature you could use for faster execution.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
FWIW your use of defined is also error prone, exists it's the way to go.
¹) and if destructing is not ok consider delete local @kws{@kwlist} , DISCLAIMER I've never used it, wasn't even actively aware of it.
In reply to Re: Faster of two options for finding keywords in a database
by LanX
in thread Faster of two options for finding keywords in a database
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |