S
S
serikd2016-07-20 10:13:14
PostgreSQL
serikd, 2016-07-20 10:13:14

How to select records that were created for some date if the creation date is stored in a timestamp?

How, besides sampling in the interval between 2016-06-01 00:00:00 and 2016-06-01 23:59:59, can you select records for 2016-06-01 if the creation date is stored in a timestamp?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2016-07-20
@melkij

The interval selection will work on the index on this field, which often already exists and is still needed for other queries.
Other options are possible - explicit casting to the date ::date, standard datetime processing functions date_trunc, date and any stable storage. And these methods can also work on an index, but a specially created functional index just for this expression.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question