Jump to content

Advice


adam84

Recommended Posts

A feature on my site is the ability to send another member a message (email type thing). Every email that is sent is obliviously stored in my database.

 

I have two columns that deal with deletion. One is if the sender deletes the message, I set that to 1(default is 0) and another other one is if the receiver deletes that message, I set that one to 1.

 

The reason why I am not deleting the row out of the database is because I give the user the option of viewing all the message contact they have had with the other user.

 

Over a while, that table (ISAM) is going to become rather large, especially if the site has a lot of members. My question is how many rows in a table are considered to be overwhelming for a simple search to execute in a reasonable manner. I understand that it can vary.

 

Say I have five millions rows in my table and I want to run the query

SELECT * FROM userMessages 
WHERE 
    (senderID = 34 and receiverID = 423) OR
    (senderID = 423 and receiverID = 34) 
ORDER BY sentDate DESC

 

Based on your sql knowledge, so you think that a query like this would run at a expectable time?

Link to comment
Share on other sites

i doubt it will really slow you down that much - it automatically restricts itself to trawling for just those IDs.  it might be easier to use IN though (however i don't know how this will affect your performance):

 

SELECT * FROM userMessages 
WHERE 
    senderID IN (34,423) AND
    receiverID IN (34,423)
ORDER BY sentDate DESC

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.