Content-Length: 278089 | pFad | http://github.com/postgrespro/postgres/commit/ae4fc52ae24785f51e3dc5a4c7e5b4d206356bdc

55 Check for interrupts in pg_trgm word similarity · postgrespro/postgres@ae4fc52 · GitHub
Skip to content

Commit ae4fc52

Browse files
Check for interrupts in pg_trgm word similarity
Calculating similarity between large strings can be timesconsuming and overrun configured statement timeouts. Check for interrupts in the main loop to ensure query cancellation can be performed. Author: Robins Tharakan <tharakan@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAEP4nAxvmfc_XWTz73bqXRhgjONi=1HaX4_NhsopA3L6UvnN1g@mail.gmail.com
1 parent 519be09 commit ae4fc52

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contrib/pg_trgm/trgm_op.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "catalog/pg_type.h"
99
#include "lib/qunique.h"
10+
#include "miscadmin.h"
1011
#include "trgm.h"
1112
#include "tsearch/ts_locale.h"
1213
#include "utils/lsyscache.h"
@@ -492,8 +493,12 @@ iterate_word_similarity(int *trg2indexes,
492493

493494
for (i = 0; i < len2; i++)
494495
{
496+
int trgindex;
497+
498+
CHECK_FOR_INTERRUPTS();
499+
495500
/* Get index of next trigram */
496-
int trgindex = trg2indexes[i];
501+
trgindex = trg2indexes[i];
497502

498503
/* Update last position of this trigram */
499504
if (lower >= 0 || found[trgindex])

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/ae4fc52ae24785f51e3dc5a4c7e5b4d206356bdc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy