Skip to content

Frequent queries pollute pg_stat_statements  #164

Open
@steve-chavez

Description

@steve-chavez

Problem

Currently we run two queries every second (ref1, ref2, ref3), note that one does a DELETE to avoid having the http_request_queue from growing too much. This pollutes pg_stat_statements and causes some users to complain and wrongly think that pg_net is causing a lot of iops.

Solution 1

We can instead add the requests done with net.http_get and others to an in-memory queue, and then read from this queue whenever there are entries available.

This can be done without a breaking change by adding a trigger to the net.http_request_queue table.

Solution 2

A simpler change would be just waking up the worker whenever there's an http_get or other function call and put it to sleep whenever there are 0 rows processed.

This would mean migrating the net.http_<method> functions to use C instead of SQL.

Related

Solving this issue can be a stepping stone towards #62.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions