Skip to main content
Question

Bug in MIN function

  • Nov 6, 2020 10:56 PM UTC
  • 5 replies
  • 29 views

atomix
Forum|alt.badge.img+1
  • Participating Frequently

We have a very large table (7T rows) with time series data, with ts_date indicating the date associated with the recorded events.
When running the query below returning 2020-01-04 as the earliest day:

SELECT min(ts_date) FROM mlog.f_event_log;
MIN       
----------
2020-01-04

However, when running a query with a filter, I am getting a lower number!

SELECT MIN(ts_date) FROM mlog.f_event_log WHERE s3_bucket_date ='2019-01-01';
MIN       
----------
2016-05-01

Updating statistics now, but this seem like a massive bug in the system. Running v9.2.1-6
Has anybody seen this bug? Any suggestion how to see if this is a know issue?
Thanks for any tips / suggestion!

5 replies

LenoyJ
Forum|alt.badge.img+1
  • Participating Frequently
  • Nov 6, 2020 11:06 PM UTC

Two different tables seem to be referenced? mlog.f_event vs mlog.f_event_log


atomix
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • Nov 6, 2020 11:11 PM UTC

Sorry, my typo, querying the same table. Fixed the typo now.


atomix
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • Nov 6, 2020 11:14 PM UTC

And this query is even crazier:

SELECT MIN(ts_date) FROM mlog.f_event_log WHERE ts_date < '2019-10-01';
MIN       
----------
2020-01-04

atomix
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • Nov 6, 2020 11:18 PM UTC

Just realized the issue. I am using DBeaver as a SQL client, but VSQL getting a correct answer with BC!

dbadmin=> SELECT min(ts_date) FROM mlog.f_event_log;
      min
---------------
 2020-01-04 BC

So the issue is DBeaver leaves BC out!


atomix
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • Nov 6, 2020 11:39 PM UTC

Thanks for your help Lenoy!