Project

General

Profile

Actions

Task #4100

closed

Move datetime evaluations to DB where appropriate

Added by Radko Krkoš over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Development - Core
Target version:
Start date:
05/22/2018
Due date:
% Done:

100%

Estimated time:
To be discussed:

Description

There are queries for all events from a time window <T-4h, T), which use externally supplied timestamp, e.g.:

2018-05-21 09:55:04.113 CEST statement: SELECT * FROM events WHERE "cesnet_storagetime" >= '2018-05-21T05:55:01.362722'::timestamp

Such queries are currently planned based on ANALYZE statistics which get out of date very quickly, leading to suboptimal plans.
Replacing those queries by:

SELECT * FROM events WHERE "cesnet_storagetime" >= NOW() - INTERVAL '4h'

would allow the planner to understand the true meaning and choose the optimal plan (single threaded sequential scan over storagetime index).
  • The origin of these queries is currently unknown, reporter is the suspect.
Actions

Also available in: Atom PDF