0

I'm currently working on a web mail client. When a user logs in, I'm fetching all the mails from the INBOX from the beginning of time. As expected this is pretty darn slow. I'm planning to implement some sort of a filtering/caching technique and was looking for some ideas.

If I fetch all the message numbers, trim them and sort them in a descending order, will I have messages from the the last message received to the first? Also, would it be preferable to store mails in a intermediate database and fetch them from there?

asked Feb 19, 2014 at 18:24

1 Answer 1

1

Why don't you reverse the order of your retrieval? Instead of starting at the beginning of time, start at the end of time (ie. most recent) and then go back in time.

Users looking at mail want to see what's most recently come in, they don't care as much about what was sent to them last week or even last year.

Another option to consider is an skip-take fetch process. Instead of waiting for everything to be fetched from the database.

  • Retrieve the 20 most recent messages
  • Return those to the client
  • Get the next 20 most recent messages
  • Return those to the client
  • Repeat as needed
answered Feb 19, 2014 at 18:41
2
  • Would introducing a intermediate database introduce more variables in the mix? Would making clever use of sessionStorage help? Thanks btw! :) Commented Feb 19, 2014 at 19:04
  • @AbijeetPatro - sounds like you would have 3 problems instead of just 1. Commented Feb 19, 2014 at 19:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.