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 7854265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:00:05+00:00 2026-06-02T20:00:05+00:00

Does FROM_UNIXTIME heavily affect the performance of a query like this: ( (calltasks.task_dueDate =

  • 0

Does FROM_UNIXTIME heavily affect the performance of a query like this:

        (
            (calltasks.task_dueDate = '".$date."') # Tasks of this date
            OR 
            (calltasks.task_dueDate < '".$date."' AND calltasks.task_status = 'scheduled') # Tasks still available on this date
            OR 
            (FROM_UNIXTIME(calltasks.task_executionTime, '%Y-%m-%d') = '".$date."') # Tasks finished this date
        )

Or I should be fine with it ??

  • 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-06-02T20:00:08+00:00Added an answer on June 2, 2026 at 8:00 pm

    Rather than converting your UNIX time to a formatted string, then comparing those (as you currently are), you would be better to use UNIX_TIMESTAMP() to convert your $date variable to a UNIX time and then compare integers (checking the difference is no more than 24 hours). Integer comparison will always be faster than string comparison:

    (calltasks.task_executionTime - UNIX_TIMESTAMP('$date')) BETWEEN 0 AND 86400
    

    Alternatively, you may find that you already have the UNIX timestamp value of $date somewhere readily available in the language from which you are invoking this query: PHP, for example, stores dates as UNIX timestamps.

    Note that you should be absolutely certain that $date cannot be manipulated to contain SQL if you are inserting it into your query in this fashion; if there is any doubt, you should use a prepared statement: if you don’t know why, or what they are, read about Bobby Tables.

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

Sidebar

Related Questions

Why does this query NOT work FROM WorkflowConfiguration WHERE ((saReplacement IS NOT NULL) AND
When estimating tasks, how does one break from the grip of Hofstadter's law ?
I'd like to run statements like SELECT date_add('2008-12-31', 1) FROM DUAL Does Hive (running
I added Comet servlet into Spring web application. This servlet does not differ from
I must create a note with image as skitch does from another app like
Since app engine 1.4.2 was released, I am getting warnings like this in my
I've got the following query on a timestamp(specified by INT(10), which kind of does
What's wrong with this...? I don't get an email back... Also, does the from
I can't quite figure out exactly what this line does from the docs: JToolBarHelper::custom(
There is a post on this topic already, but it does not have an

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.