My program is doing a large data synchronization between two databases on
addresses. When I queried the destination database for an address by
content, (with the query having to be a query of the destination address'
street number, street name, predirection, postdirection, suffix, and postal
code), I found that I would have too much time spent on network overhead
(opening the connection and transmitting the payload). The Oracle database
has to search the address by content anyways so it makes no difference if
it has to search 1 record or 1000 records in the where clause statement. I
can fine tune how many records I want to pull across at once, when I query
the addresses by content, but I'm not writing a web application, where the
data queried is usually small.
Thank you for your response. I took an alternate approach where I set the
value of "planCache" to 'new SoftLimitMRUCache(8)'. I don't think I would
have noticed the problem if my .NET program was running in 64 bit mode, but
I think .NET programs in 32 bit mode are limited to 1.5 GB of Heap space
size.
On Thursday, December 4, 2014 3:08:03 PM UTC-6, Gunnar Liljas wrote:
>
> Hi!
>
> 10000 individual where clauses?! That sounds like some that could be
> optimized before it hits both NHibernate and the database,
>
> Still, if you really need to clear the query plan cache I guess it can be
> done using reflection.
>
> Try this:
>
> public static class SessionFactoryExtensions
> {
> public static void ClearQueryPlanCache(this ISessionFactory
> sessionFactory)
> {
> var factory = sessionFactory as SessionFactoryImpl;
> if (factory == null)
> {
> return;
> }
> var queryPlanCacheType = typeof (QueryPlanCache);
>
> var cache = queryPlanCacheType
> .GetField("planCache", BindingFlags.Instance | BindingFlags.NonPublic)
> .GetValue(factory.QueryPlanCache) as SoftLimitMRUCache;
>
>
> if (cache != null)
> {
> cache.Clear();
> }
> }
> }
>
>
> Maybe you want to trigger garbage collection too.
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.