Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

40
Views
Postgresql how to add good timing check statement in where clause

I want to select all columns where the dates are not older than start_time to avoid older dates.

What would be a good statement without performance issues?

here is my code:

 SELECT 
 
 u.id,
 u.firstname,
 u.lastname,

 json_agg(json_build_object('plan_id', wp.id, 'start_time', wp.start_time, 'end_time', wp.end_time)) as times
 
 FROM workers_plan wp

 JOIN users u 
 ON wp.user_id = u.id
 
 WHERE wp.user_id = ANY($1::uuid[]) AND wp.tenant_id = $2 AND wp.start_time > NOW()
 
 GROUP BY u.id;

I added wp.start_time > NOW() but is there a better statement on what I can do?

over 2 years ago · Carlos Garzón Colorado
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!