Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommendation on ID indexes #24

Open
GoogleCodeExporter opened this issue May 13, 2015 · 1 comment
Open

Recommendation on ID indexes #24

GoogleCodeExporter opened this issue May 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Hi,

We have structure ( Trade ) which has ID fields unique always.
We noticed if use Hash or Navigable index on ID field to push it into CqEngine 
collection the size of heap taken is doubled up, which is baffling in a way. 
SO basically adding a index where values are going to Unique is not working out 
well for us. DO you have any recommendation on which index to be used and how 
we can reduce the memory footprint here ?
The more indexes the heap size is getting lot worst, specially if the values 
are unique and spread is high.

Any recommendations are highly appreciated. 

Thanks,
Sandeep

Original issue reported on code.google.com by sandeepd...@gmail.com on 15 Oct 2013 at 6:58

@GoogleCodeExporter
Copy link
Author

Hi Sandeep, this belongs more in the forum than as an issue.

Have you tried IndexQuantization? This is a good way to reduce memory usage.

Also are your ID values sparse? If so you could write your own quantizer to 
better handle sparse values, like this one:

/**
 * Converts sparse double values, to a fixed number of buckets.
 * <p/>
 * This quantizer should only be used with equality-based indexes, such as {@code HashIndex}.
 */
public class SparseDoubleQuantizer implements Quantizer<Double> {
    private final int numBuckets;
    public SparseDoubleQuantizer(int numBuckets) {
        this.numBuckets = numBuckets;
    }
    @Override
    public Double getQuantizedValue(Double attributeValue) {
        return (double) attributeValue.longValue() % numBuckets;
    }
}

The quantizer above will restrict the size of an equality-based index (e.g. 
HashIndex) to a fixed number of buckets, independent of the number of unique 
values of your IDs. But it cannot be used with a NavigableIndex.

This is not the best place to answer questions. If you like post your question 
in the forum http://groups.google.com/group/cqengine-discuss and we can 
continue discussion there. thanks!

Original comment by ni...@npgall.com on 15 Oct 2013 at 12:10

  • Changed state: Invalid
  • Added labels: Type-Other
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant