I have been searching all day to find a better answer to my question but those I found was useful
but do not critically analyse my question.
I am building a chat room using php, mysql, jquery and ajax.
The target group members are 3000 people who will frequently
chat every day, so I am expecting like one million messages a day.
The chat room is open to all the members, that means
every member has the same priviledge to send and view
In this case, every member has the permission to delete messages whether sent by him or different members,
however deleted messages should not affect other users. I wouldnt also keep messages for more than two days,
meaning every sent message should be deleted after two days.
Below are the sample tables that represents the logics above
Now, if I am to implement the schema above, it means that every single sent message has to do 3000 inserts into the
recipient table and one insert into the messages table. This also means that if there are 50 sent messages within 1 minute there would be more
inserts within the one minute. At the same time 3000 people are viewing the messages. Awwsh! more work load on the database within that minute.
Please is there a way to handle this, scalability and performance wise?
Don't you think this would give my queries more load using four tables and doing many JOINs. Cant we have a simple way to solve this, which will increase speed. That even means, at every insert into the message table, there should be the same insert into the unread table, when all members are online
Look into partitioning your table if you need more speed. If that's not enough, then you'd more be thinking about client-side processing. Do you need to "know" on the server whether a user read one of the messages?
If not, then you might be helped quickly with a XMPP-server. The local client could then keep track of the messages it receives, and which ones are read.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
Delete the recipient-table, and add a table like below;
Add a record to that table when the user read a message set 'IsDeleted' to false.
When user delete a message, set IsDeleted to true.
When fetching all messages for a particular user, fetch all messages where the messageId isn't named in the MessageStatusPerUser table and Messages marked 'IsDeleted' as false
messages not appearing in MessageStatusPerUser table are unread.
messages appearing in MessageStatusPerUser table and flagged IsDeleted as false are read.
messages appearing in MessageStatusPerUser table and flagged IsDeleted as true are deleted messages.
I have a package to import data from Excel to SQL tables. I have created and depolyed the package on production server say "ProdServer". Also I have created job on the same server and it runinng the package successfully. Even I run it manually it is running properly. But problem here is when I am connecting to SQL installed on the production server from my local machine using windows authentication and trying to run the package manually it gives below error.
Executed as user: SERVERNAME\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 32-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 7:41:10 AM Error: 2014-07-15 07:41:17.24 Code: 0xC0202009 Source: ImportMasterData Connection manager "PracticeMapping" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. End Error Error: 2014-07-15 07:41:17.27 Code: 0xC020801C Source: Load Practice Get Practice  Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "PracticeMapping" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2014-07-15 07:41:17.29 Code: 0xC004701A Source: Load Practice SSIS.Pipeline Description: component "Get Practice" (69) failed the pre-execute phase and returned error code 0xC020801C. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 7:41:10 AM Finished: 7:41:17 AM Elapsed: 6.692 seconds. The package execution failed. The step failed
So in short when I run the packgae direclty from production server it works fine but from local machine or any other machine by connecting to the SSMS and running manually, it get failed. Please help me guys on this issue. Its very very urgent.