-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to speed up inserts?
PostPosted: Mon Jul 12, 2010 1:48 pm 
Newbie

Joined: Mon Jun 07, 2010 3:07 pm
Posts: 4
Hi, I am trying to insert a relatively modest amount of data via NHibernate. The data consists of about 400 objects that contain two lists of child objects (1-2 child objects per list). The way the objects are inserted into the database is relatively inefficient because it happens one object at a time. However, the insert runs for many minutes, which seems long even given this inefficiency.

How would I got about improving the performance? Can I change something in by database configuration or mappings to speed up this process?

Here is the DB configuration:

Code:
private static ISessionFactory CreateSessionFactory()
        {
            //Create session
            return Fluently.Configure()
              .Database(MsSqlConfiguration.MsSql2008            .ConnectionString(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString).ShowSql().AdoNetBatchSize(50))
              .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Schedule>())
              .BuildSessionFactory();
        }


And here is the mapping for the object in question:

Code:
public class RotationEventMap : ClassMap<RotationEvent>
    {
        public RotationEventMap()
        {
            Id(x => x.UniqueID);
            HasMany(x => x.TimeSlots).Not.LazyLoad().BatchSize(100).Cascade.All();
            HasManyToMany(x => x.Tags).Table("TagRotationEvent").Not.LazyLoad().BatchSize(100);
        }
    }


Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.