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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:55:07+00:00 2026-05-25T13:55:07+00:00

I have lots of content that needs to be published on a web site

  • 0

I have lots of content that needs to be published on a web site some time in the future. What’s the most efficient way to publish it when the time comes?

My current implementation is in two datetime columns: online_at and offline_at.

The sql query to fetch content looks something like this:

SELECT * 
  FROM contents 
 WHERE online_at > current_timestamp 
   AND (offline_at IS NULL OR 
        offline_at < current_timestamp);

with an index over the online_at and offline_at columns. It works well and there are no obvious performance penalties, but I’m still wondering if there is a more efficient way to go about this. Is there a way to reduce the index to one simpler column (not a datetime, which seems expensive)?

  • 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-25T13:55:07+00:00Added an answer on May 25, 2026 at 1:55 pm

    I’ve seen your construction many times and I’ve only seen it become prohibitively slow when hitting millions of rows, so I’m not sure you should really worry about the construction.

    One thing, that I haven’t tried myself, but that could give you increased parallelism, is to have seperate indexes on online_atand offline_at and then using EXCEPT/MINUS (depending on your DB). In essence just use the IDs, but this could obviously be extended with the entire field list except for the dates. Ie:

    SELECT id, header, text, ... 
      FROM CONTENT
     WHERE online_at < current_timestamp
     MINUS
    SELECT id, header, text, ... 
      FROM CONTENT
     WHERE offline_at < current_timestamp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web site technology that I use for scores of clients.
I have many web pages that needs to auto-refresh once a minute. Easily done
I have UITableView with very large cells with lots of content (more than one
I have lots(+2000) of GUIDs(in some network class) and my program must find one
I have a folder with content in my solution, it contains lots of subdirectories.
I have lots of jpeg images that are oversized (height, width), all with different
I'm working as a web developer and have lots (hundreds) of links with hacks,
I have a page that has lots of images and other code that would
I have a UI problem with some CSS that I was hoping to get
I have to download some content from a website every day so I figure

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.