-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to index by joining tables
PostPosted: Mon Nov 30, 2009 6:56 am 
Newbie

Joined: Tue Aug 04, 2009 6:46 am
Posts: 17
hi all,

i have 2 tables article(rows>1 million) and comments(rows>1million)

some of articles have comments in comments table
i have indexed these tables using hibernate lucene indexing (annotations)
my requirement is when a user requests for an article i want to fetch the article from article table and the count of comments if made from comments table
here every article has unique art_code using which the comments count is obtained

for this i have written a view as select a.* , count(c.art_code) from article a left join comment c on c.art_code=a.art_code group by a.id

i have tested this view for just few rows( around 100 rows) but unfortunately this view takes lot of execution time when millions of rows are available in both tables

to fetch article from index it is taking very less time (1 or 2 seconds) but from index i can get comments count ..

so my questions are:

Apart from this view concept is there any other way to fetch comment count by joining these two tables

or how can i index these two tables by joining

thanks a lot
bye


Top
 Profile  
 
 Post subject: Re: how to index by joining tables
PostPosted: Mon Nov 30, 2009 11:40 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
you're fetching all articles? You mentioned you wanted to load the article selected by user.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: how to index by joining tables
PostPosted: Tue Dec 01, 2009 12:05 am 
Newbie

Joined: Tue Aug 04, 2009 6:46 am
Posts: 17
s.grinovero wrote:
you're fetching all articles? You mentioned you wanted to load the article selected by user.


thanks for your response
i want both

i have written the view for listing the latest articles with their comments count and individual article with comments count is needed when user requests for single article

bye


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

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.