Uninterruptible slow geo_ops.c

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Uninterruptible slow geo_ops.c
Date: 2015-12-11 17:48:26
Message-ID: 20151211174826.GF2762@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

A customer of ours hit some very slow code while running the
@>(polygon, polygon) operator with some big polygons. I'm not familiar
with this stuff but I think the problem is that the algorithm converges
too slowly to a solution and also has some pretty expensive calls
somewhere. (Perhaps there is also a problem that the algorithm *never*
converges for some inputs ...)

While I'm not familiar with the code itself, and can't post the exact
slow query just yet, I have noticed that it is missing a
CHECK_FOR_INTERRUPTS() call to enable cancelling the slow query. I'd
backpatch this all the way back. (The exact issue they hit is mutual
recursion between touched_lseg_between_poly and lseg_between_poly.
Since the latter also recurses on itself, the best way forward seem to
add a check for interrupts in the loop there.)

I will follow up on the actual slowness later, as warranted.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
geo_ops-int.patch text/x-diff 539 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-12-11 18:08:32 Re: Cluster "stuck" in "not accepting commands to avoid wraparound data loss"
Previous Message Aleksander Alekseev 2015-12-11 17:42:19 Re: Patch: fix lock contention for HASHHDR.mutex