query-cache

Doctrine queries take over 4 seconds to execute

We're in the last stage of a project and started optimizing it. After a few tests, we realized that most (if not all) of the time spent loading a page, is spent in Doctrine. Out of 5 seconds page load, 3 - 4 seconds are spent only on 2 Doctrine queries. We've enabled query cache on the mysql server and on Doctrine as well as result ca...

How do you enable hibernate query cache on a session level only?

Good day, What if I have a query that gets called multiple times in a single thread, and I just want to cache that query (and its result) for that thread (or for that session since I'm using one session per thread), how can I do that ? Note: My 2nd level cache is turned on but it's used mostly for session.get(...). But I do not want to...

NHibernate query cache and WCF

I've enabled query cache for one of my queries, it works fine (query result is taken from query cache and entities from second level cache) when I run a test or a console application. However, if I run the same queries through a WCF service, the cache is never hit. I've also checked the logs in both cases and they are practically ident...

Hibernate Second-Level Query Cache not working Eager Fetching

In NHibernate Profiler I observed that when I use eager fetching on an association, using "left join fetch" in an HQL Query or .SetFetchMode() in a Criteria Query the query no longer gets cached in the query cache. In fact from what I can see only very basic queries are cached. If anyone can give me some insight into what queries get c...

Hibernate query cache - for objects not in the 2nd level cache - risky? usefull? bad practice?

Related to this question Premise: These are my assumptions, based on my reading, experience and understanding, they may be wrong, if they are, please comment and I'll edit the question. Query cache is good mostly along with 2nd level cache Query cache caches the identifiers results of queries + parameters Query cache is risky if the...

Hibernate - query caching/second level cache does not work by value object containing subitems

Hi! I have been struggling with the following problem: I have a value object containing different panels. Each panel has a list of fields. Mapping: <class name="com.aviseurope.core.application.RACountryPanels" table="CTRY" schema="DBDEV1A" where="PEARL_CTRY='Y'" lazy="join"> <cache usage="read-only"/> <id name="ctryCode"> <column name...

Is it important to deal with query caching in ActiveRecord unit tests?

In the Hibernate world, you can often have unit tests that appear to pass but there are actually bugs that don't show up because you're dealing with cached data. For example, you may save a parent with its children thinking it's cascading the save. If you re-query for the parent after the save and test the size of the child collection,...

How does Query caching improves performance in nHibernate?

How does query caching works and how does it improves performance in nHibernate? ...

How can an improvement to the query cache be tracked?

I am parameterizing my web app's ad hoc sql. As a result, I expect the query plan cache to reduce in size and have a higher hit ratio. Perhaps even other important metrics will be improved. Could I use perfmon to track this? If so, what counters should I use? If not perfmon, how could I report on the impact of this change? ...

MySQL query cache vs caching result-sets in the application layer

I'm running a php/mysql-driven website with a lot of visits and I'm considering the possibility of caching result-sets in shared memory in order to reduce database load. However, right now MySQL's query cache is enabled and it seems to be doing a pretty good job since if I disable query caching, the use of CPU jumps to 100% immediately. ...

NHibernate best pratices (Query cache with much static data)

We have a situation, where we feel we do not fully take advantage of NHibernate's capabilities, which reduces performance. The actual situation is reduced to a "blogs with posts" example for this question. A blog site, where each user can have its own blog which has an arbitrary number of posts. Therefore, there is a table for posts def...

understanding hibernate cache

If I have this method in object class: @OneToMany( fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, mappedBy = "object" ) @org.hibernate.annotations.Cascade( {org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Column( nullable = false ) public Set<ObjectEntry> getObjectEntries() { return this.objectEntries; } ...

Need to solve a query cache problem

I'm developing an double-entry accounting system and I need to insert posting records without any gaps in the sequential id. Since all database access will happen through a web application, I'm taking care of id generation using a syncronized static variable: import org.hibernate.*; public class JournalService { private static ...

Hibernate 3.5.5, Second Level Cache Configuration

Hello, After implement Hibernate Monitoring, i have noticed that hibernate execute too much query than it have on the query string table in statistics. Screen-shots of statistics: I think, implement hibernate 2nd level cache and particularly hibernate query cache help me to reduce this amount of query execute. I searched on the web...

Mysql to SQL Server: is there something similar to query cache?

Hi, I'm trying to optimize a SQL Server. I have some experience with Mysql and one of the things that usually help is to enable query cache, that will basically cache query results as long as you are running the same query. Is there something similar to this on SQL Server? Could you please point what is the name of this feature? Thank...

How to use ActiveRecord Query Cache with Custom SQL

In a stats part of a Rails app, I have some custom SQL calls that are called with ActiveRecord::Base.execute() from the model code. They return various aggregates. Some of these (identical) queries are run in a loop in the controller, and it seems that they aren't cached by the ActiveRecord query cache. Is there any way to cache custom...