You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by neerajbhatt <ne...@gmail.com> on 2017/07/05 12:17:54 UTC
Group index taking too much time
Hi All
We have pushed around 1.4 million item objects (with group index) and with
following query takes around 80 ms (on server), which is way ahead for our
use case. Please suggest
String rating="0";
String review="0";
String download="0";
StringBuilder buff = new StringBuilder("SELECT T._VAL FROM "
+ "ITEMCACHE.Item as T "
+ " WHERE "
+ " T.rating=? AND T.reviews=? AND T.downloads=? "
+ " limit 10");
SqlFieldsQuery qry = new SqlFieldsQuery(buff.toString());
List<List<?>> res = cache.query(qry.setArgs(new
Object[]{rating,review,download})).getAll();
///Item object is
public class Item2 implements Serializable {
private static final long serialVersionUID = 1L;
@QuerySqlField(index = true, orderedGroups = { @QuerySqlField.Group(name =
"idx1", order = 2) })
private int downloads;
@QuerySqlField(index = true, orderedGroups = { @QuerySqlField.Group(name =
"idx1", order = 0) })
private double rating;
@QuerySqlField(index = true, orderedGroups = { @QuerySqlField.Group(name =
"idx1", order = 1) })
private int reviews;
@QuerySqlField(index = true)
@AffinityKeyMapped
private String id;
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public int getReviews() {
return reviews;
}
public void setReviews(int reviews) {
this.reviews = reviews;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Group-index-taking-too-much-time-tp14320.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
RE: Group index taking too much time
Posted by neerajbhatt <ne...@gmail.com>.
Yes we saw execution plan and everything seems ok in group index, Thanks for
help, When we moved from group index to individual index performance
increased by 20 times (close to 5 ms)
Thanks
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Group-index-taking-too-much-time-tp14320p14385.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
RE: Group index taking too much time
Posted by vkulichenko <va...@gmail.com>.
Did you check the execution plan? Is index properly used? Also how big is
result set returned by the query before 'limit 10' is applied?
BTW, it's generally not valid to do 'limit 10' without ordering, as you can
get different results from consequent execution of the same query with the
same data set.
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Group-index-taking-too-much-time-tp14320p14344.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
RE: Group index taking too much time
Posted by Neeraj Bhatt <ne...@gmail.com>.
Hi Mike
Yes, item has same index.
configured as item 2
We have a cluster of 3 nodes. Item is a partitioned cache with backup as
one.
We are executing queries from a single client.
On 05-Jul-2017 7:46 PM, "Michael Griggs" <mi...@gridgain.com>
wrote:
Hi,
I see that you are referencing "Item" not "Item2" in your SQL query. Does
"Item" have the same index configured? Also, please describe your network
topology, how many server and client nodes are you running?
I built a reproducer based on your code, executed your query 5000 times, and
each query takes an average of 140 microseconds :
Executing query...
Query executed.
Execution time for 5000 queries = 700191368ns. Avg Per Query: 140
microseconds
Kind regards
Mike
-----Original Message-----
From: neerajbhatt [mailto:neerajbhatt2000@gmail.com]
Sent: 05 July 2017 14:18
To: user@ignite.apache.org
Subject: Group index taking too much time
Hi All
We have pushed around 1.4 million item objects (with group index) and with
following query takes around 80 ms (on server), which is way ahead for our
use case. Please suggest
String rating="0";
String review="0";
String download="0";
StringBuilder buff = new StringBuilder("SELECT T._VAL FROM "
+ "ITEMCACHE.Item as T "
+ " WHERE "
+ " T.rating=? AND T.reviews=? AND
T.downloads=? "
+ " limit 10");
SqlFieldsQuery qry = new SqlFieldsQuery(buff.toString());
List<List<?>> res = cache.query(qry.setArgs(new
Object[]{rating,review,download})).getAll();
///Item object is
public class Item2 implements Serializable {
private static final long serialVersionUID = 1L;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 2) })
private int downloads;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 0) })
private double rating;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 1) })
private int reviews;
@QuerySqlField(index = true)
@AffinityKeyMapped
private String id;
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public int getReviews() {
return reviews;
}
public void setReviews(int reviews) {
this.reviews = reviews;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Group-index-taking-too-much-t
ime-tp14320.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
RE: Group index taking too much time
Posted by Michael Griggs <mi...@gridgain.com>.
Hi,
I see that you are referencing "Item" not "Item2" in your SQL query. Does
"Item" have the same index configured? Also, please describe your network
topology, how many server and client nodes are you running?
I built a reproducer based on your code, executed your query 5000 times, and
each query takes an average of 140 microseconds :
Executing query...
Query executed.
Execution time for 5000 queries = 700191368ns. Avg Per Query: 140
microseconds
Kind regards
Mike
-----Original Message-----
From: neerajbhatt [mailto:neerajbhatt2000@gmail.com]
Sent: 05 July 2017 14:18
To: user@ignite.apache.org
Subject: Group index taking too much time
Hi All
We have pushed around 1.4 million item objects (with group index) and with
following query takes around 80 ms (on server), which is way ahead for our
use case. Please suggest
String rating="0";
String review="0";
String download="0";
StringBuilder buff = new StringBuilder("SELECT T._VAL FROM "
+ "ITEMCACHE.Item as T "
+ " WHERE "
+ " T.rating=? AND T.reviews=? AND
T.downloads=? "
+ " limit 10");
SqlFieldsQuery qry = new SqlFieldsQuery(buff.toString());
List<List<?>> res = cache.query(qry.setArgs(new
Object[]{rating,review,download})).getAll();
///Item object is
public class Item2 implements Serializable {
private static final long serialVersionUID = 1L;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 2) })
private int downloads;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 0) })
private double rating;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "idx1", order = 1) })
private int reviews;
@QuerySqlField(index = true)
@AffinityKeyMapped
private String id;
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public int getReviews() {
return reviews;
}
public void setReviews(int reviews) {
this.reviews = reviews;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Group-index-taking-too-much-t
ime-tp14320.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.