Temporal Function Issues
Hello all: I am trying to find the most efficient way to filter results for those matching today only. My events table has 550 million rows and I want a view as follows- CREATE VIEW events_today AS SELECT * FROM events WHERE str_to_date(timestamp_to_str(event_timestamp, '%Y-%m-%d'), '%Y-%m-%d') = CURRENT_DATE which should give me all events with today's date. Running the SELECT by itself also never returns. However, the query just hangs without ever returning. I'm running 11.29.3 (Mar2018) on CentOS 7 with 128GB and 16 Cores. Adam
Hi Adam, did/could you try replacing str_to_date(timestamp_to_str(event_timestamp, '%Y-%m-%d'), '%Y-%m-%d') by a simple cast(event_timestamp as date) ? Best, Stefan ----- On Jun 13, 2018, at 4:52 PM, Doherty, Adam adam.doherty@esso.ca wrote:
Hello all:
I am trying to find the most efficient way to filter results for those matching today only. My events table has 550 million rows and I want a view as follows-
CREATE VIEW events_today AS SELECT * FROM events WHERE str_to_date(timestamp_to_str(event_timestamp, '%Y-%m-%d'), '%Y-%m-%d') = CURRENT_DATE which should give me all events with today's date.
Running the SELECT by itself also never returns.
However, the query just hangs without ever returning.
I'm running 11.29.3 (Mar2018) on CentOS 7 with 128GB and 16 Cores.
Adam _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Hi Stefan:
Thanks for the quick reply. Yes casting to a date sorts it out.
It's also much simpler.
I was unaware of cast in SQL. Thank you for teaching me something new.
Adam
-----Original Message-----
From: users-list [mailto:users-list-bounces+adam.doherty=esso.ca@monetdb.org] On Behalf Of Stefan Manegold
Sent: Wednesday, June 13, 2018 09:03
To: Communication channel for MonetDB users
Hello all:
I am trying to find the most efficient way to filter results for those matching today only. My events table has 550 million rows and I want a view as follows-
CREATE VIEW events_today AS SELECT * FROM events WHERE str_to_date(timestamp_to_str(event_timestamp, '%Y-%m-%d'), '%Y-%m-%d') = CURRENT_DATE which should give me all events with today's date.
Running the SELECT by itself also never returns.
However, the query just hangs without ever returning.
I'm running 11.29.3 (Mar2018) on CentOS 7 with 128GB and 16 Cores.
Adam _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (2)
-
Doherty, Adam
-
Stefan Manegold