| From: | Aliaksandr Kalenik <akalenik(at)kontur(dot)io> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | [PATCH] nodeindexscan with reorder memory leak |
| Date: | 2022-01-30 02:49:34 |
| Message-ID: | CAHqSB9gECMENBQmpbv5rvmT3HTaORmMK3Ukg73DsX5H7EJV7jw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hey!
I was investigating a leak reported in the PostGIS issues tracker [1] which
led me to the Postgres side where the problem really is. The leak is
reproducible with query from original ticket [1]:
WITH latitudes AS (
SELECT generate_series AS latitude
FROM generate_series(-90, 90, 0.1)
), longitudes AS (
SELECT generate_series AS longitude
FROM generate_series(-180, 180, 0.1)
), points AS (
SELECT ST_SetSRID(ST_Point(longitude, latitude), 4326)::geography AS geog
FROM latitudes
CROSS JOIN longitudes
)
SELECT
geog,
(
SELECT name
FROM ne_110m_admin_0_countries AS ne
ORDER BY p.geog <-> ne.geog
LIMIT 1
)
FROM points AS p
;
The leak is only noticeable when index scan with reorder happens as part of
subquery plan which is explained by the fact that heap tuples cloned in
reorderqueue_push are not freed during flush of reorder queue in
ExecReScanIndex.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-nodeindexscan_with_reorder_memory_leak.patch | application/octet-stream | 885 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Geoghegan | 2022-01-30 04:42:36 | Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations |
| Previous Message | Nathan Bossart | 2022-01-30 00:31:48 | Re: archive modules |