Skip to main content

Posts

Showing posts with the label Database

Why NoSql come into the picture ?

We increasingly live in a world where data doesn’t fit nicely into the tidy rows and columns of an RDBMS. Mobile, social, and cloud computing have spawned a massive flood of data. 80 percent of all enterprise data as unstructured. What's more, unstructured data is growing at twice the rate of structured data. As the world changes, data management requirements go beyond the effective scope of traditional relational databases. The first organizations to observe the need for alternative solutions were Web pioneers, government agencies, and companies that specialize in information services. Increasingly now, companies of all stripes are looking to capitalize on the advantage of alternatives like NoSQL and Hadoop: NoSQL to build operational applications that drive their business through systems of engagement, and Hadoop to build applications that analyze their data retrospectively and help deliver powerful insights. Enjoy !!!!!!

How To Choose A NoSQL Database?

How To Choose A NoSQL Database? NoSQL databases are now part of web-scale architecture. The question is when to use what? Below, I try to compare the NoSQL data stores that I have worked with. Hopefully, it would be useful for programmers exploring and deciding the technology for their web-scale application. When to use NoSQL Before deciding on to use NoSQL instead of a SQL technology, you should ask yourself following questions about your use case (includes  ACID  test of your application) : Transactions vs No transactions (Do you need atomicity?) [Most NoSQL databases don’t support transactions] Consistent or eventual consistent (Are you okay with eventual consistency?) [Most support configurable consistency mode. You should test your scale with the consistency mode your application requires. For example, your performance test holds no good when done on “eventual consistency” mode and you decide to use hard consistency for your application.] Vertical vs horizontal

Mongodb Query Optimization

Have slow database queries? Get more information on the performance of your queries using the explain feature. Using the mongo shell, invoke the explain() method on a cursor: > db.collection.find(query). explain() example : > db.user.find().explain(); The result will be a document that contains the explain output: {    "cursor" : "BasicCursor",    "indexBounds" : [ ],    "nscanned" : 57594,    "nscannedObjects" : 57594,    "nYields" : 2 ,    "n" : 3 ,    "millis" : 108,    "indexOnly" : false,    "isMultiKey" : false,    "nChunkSkips" : 0 } For More Detail visit : http://docs.mongodb.org/ manual/reference/explain/ Cheers  !!!!!!!!!!!!!!!!!

How To Use Map Reduce in Spring Mongo data

Suppose  I have order table and I want to find out best five selling product. Create a method that returns best product of ValueObject Type . ValueObject Type basically contain id and corresponding values to those ids as shown below: public class ValueObject implements Comparable<ValueObject>{ private Object id; private int value; public Object getId() { return id; } public void setId(Object id) { this.id = id; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } @Override public String toString() { return "ValueObject [id=" + id + ", value=" + value + "]"; } @Override public int compareTo(ValueObject o) { if(o instanceof ValueObject){ return o.getValue()-this.getValue(); } else{ throw new ClassCastException(); } } } Now, you can call mapReduce method on MongoTemplate which retur