When you split, you need an insert and a delete instead of an update. Splitting also means that you have to query two table in some situations.
You could consider a solution where you have a separate table to store just primary keys of unread messages. Then you don't have to move records around and should get a fast access. You could even model this with nice entity classes and don't need any native SQL. At the end, you need to try it. Don't implement any performance optimizations if you are not sure that they are needed. On 17 Aug., 08:29, ReverseBlade <[email protected]> wrote: > No one really worked with big tables ? > > On Aug 14, 5:39 pm, ReverseBlade <[email protected]> wrote: > > > If you have 50 million of records then this solution is not feasible > > imho, > > that's why I am trying to split it. > > > On Aug 14, 4:34 pm, Stefan Steinegger <[email protected]> > > wrote: > > > > Why not simply: > > > > IList<string> result = session > > > .CreateQuery("select m.Text from Message where m.Read = false > > > and ...") > > > .List<string>(); > > > > and > > > > session.Update("Message set m.Read = false where ..."); > > > > You could also have a list of ids to know which messages need to be > > > set to read. > > > > On 14 Aug., 14:39, "[email protected]" <[email protected]> wrote: > > > > > In our domain model, we have a Message entity. Message entity is basic > > > > class with a simple string property and a status bool property if the > > > > message is "read" or not . The thing is we are expecting millions of > > > > messages and we would like to archive "read" messages. > > > > > So I thought I could make use of "entity-name" property to > > > > distinguish messages and "read" messages into to two different tables > > > > so that selecting unread messages will perform better. > > > > > But I am not sure how to manage it exactly, because a message can be > > > > transformed from read to unread if it is read. > > > > > So what do you recommend, entity-name is the way to go? should I use > > > > an interceptor to make unread messages read (thus returning a > > > > different entity name if message is read from interceptor) Will this > > > > move the row from one table to another ? > > > > > What other strategies you use for "big" tables ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
