[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-521?pag...
]
Marc Schipperheyn commented on HSEARCH-521:
-------------------------------------------
After reviewing fetch profiles I was initially very enthusiastic. It seems to be the
answer to some of the infuriating issues with n+1.
However, on review it doesn't work or at least not as I would expect. Running
MassIndexer on an entity
@FetchProfiles({
@FetchProfile(name = "search", fetchOverrides = {
@FetchProfile.FetchOverride(entity = MyClass.class, association = "foreign",
mode = FetchMode.JOIN)
})
})
@Entity
@Table
public class MyClass implements IOffer, Serializable {
a method
@OneToOne(optional = false, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "FK_ForeignID", nullable = false, updatable = false)
@IndexedEmbedded
public Foreign getForeign() {
return foreign;
}
I see for each MyClass a separate query being executed for getForeign. This does not
happen when I map getForeign as a FetchType.EAGER association.
This doesn't seem to just happen with search. I also see this behaviour on other types
of hibernate core queries. Don't really understand either why there is no FetchMode
for inner joins.
Anyway, this doesn't really apply to Hibernate Search other than that it doesn't
look like FetchProfile works for it.
Improve performance MassIndexer through Eager fetching
------------------------------------------------------
Key: HSEARCH-521
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-521
Project: Hibernate Search
Issue Type: Improvement
Components: engine
Affects Versions: 3.2.0.CR1
Reporter: Marc Schipperheyn
Priority: Minor
Fix For: 3.3.0
The MassIndexer fetches all of a certain entity from the database. It then proceeds to
index it and the tree of IndexedEmbedded objects is traversed. In doing so, a lot of
additional queries get executed. These queries are not really necessary, since we know
beforehand that the data is needed for the indexing operation. So it would make sense to
eagerly fetch all associations that are marked as indexEmbedded. This way MassIndexer
would significantly speed up.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira