Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 996667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:54:50+00:00 2026-05-16T06:54:50+00:00

My web application needs to get the results of all the items which have

  • 0

My web application needs to get the results of all the items which have their time value for this minute. My table has a time attributes

id, message, time, ...,

where time is of type timestamp with timezone.
I need to get a list of all entries where the time is the current minute. Comparing the entire value does not match because the timestamp has microsecond resolution.

Currently I am using the following query to return this list and it works, but I think there should be a more efficient way of doing this.

SELECT * FROM notification WHERE 
 date_part('year', time) = date_part('year', current_date) AND 
 date_part('month', time) = date_part('month', current_date) AND 
 date_part('day', time) = date_part('day', current_date) AND 
 date_part('hour', time) = date_part('hour', current_time) AND 
 date_part('minute', time) = date_part('minute', current_time);

I’d also like to know how to get the results for the this and the previous minute or the last ‘n’ minutes.
Database is PostgreSQL 8.4.3

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:54:52+00:00Added an answer on May 16, 2026 at 6:54 am

    I’d try something like this:

    WHERE
        time >= date_trunc('minute', now()) AND
        time < date_trunc('minute', now()) + INTERVAL '1 minute';
    

    This will define the boundaries and search for times within that range, which means it still can use the index you have (or should have) on the time column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which needs to perform a file copy operation and
I am developing a web application who needs to get the folders and sub
I am trying to get a search web application running and needs to use
I'm working on an application that needs to get the source of a web
I am looking to build a web application which needs to run resource-intensive MCMC
I'm building a web application with Ruby on Rails which needs to be highly
I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which
I have a pretty typical user table setup for my web application: user_id |
I'm trying to build a web application in which users can invite their friends
Here's the deal: I have an Android application that needs to call a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.