What is the use of indexes in Couchbase server? - couchbase

Can anyone explain what is the use of indexes in Couchbase server in layman terms?

Indexes in Couchbase Server are used for the same reason indexes are used in any database: to enable and enhance the performance of queries.

Related

mysql memcached

I have some queries regarding mysql memcached such as :
1 . What is the main difference between mysql cache and memcached ?mainly I want to ask what caching techniques are adopted in both of these?
2 .What is the benefit of using memcached over mysql cache and What addiional functionality does memcached provide over mysql cache??
3 .Can I use memcached in my existing java application without making any modifications to my existing JDBC code and if not then what necessary modifications do I need to make in my JDBC code.?? please explain with an example that how can i do this .
4. Is it good to use mysql memcached for frequently updating tables?
5 . I want to use memcached in my java application but I am unable to find relevant examples so please provide me some examples showing that how can I use it ??
I have searched for the answers on web but was unable to find the relevant examples. So please provide the answers with a detailed explanation and some examples.
Thanks in anticipation.
Depending on engine used, MySQL will typically outperform memcached. Reasoning and extended explanation found at the link
Probably none, if anything you can very well end up wasting RAM for no significant benefit. There is no reason why connecting to memcached bears less strain than connecting to MySQL - both should be equally fast/slow, and many languages and frameworks implement connection pooling so that concurrent requests are served over established MySQL connections, therefore the performance loss due to connecting to MySQL is circumvented.
N/A
How would you use memcached for frequently updated tables? The data must be written to the disk, how will memcached help there? MySQL's cache is faster than memcached so I don't see how memcached helps you at all in this scenario.
N/A
I didn't refer to points 3 and 5 because there are googlable examples all over the net.
Long story short, you don't need to use memcached with MySQL if you use MySQL properly (proper dedicated server, with adequate InnoDB / TokuDB configuration, using prepared statements to alleviate SQL lexing on frequent queries).

Concerns Of Using Mixed MyISAM & InnoDB On AWS RDS

I am really new to AWS and I want to migrate my database to AWS RDS. But I'm facing several issues. The database is entirely built using MyISAM instead of InnoDB. From what I read at AWS RDS documentation, I understand that I can enjoy the AWS RDS features if I use InnoDB for the database, e.g. the daily backup and the read replica.
The main reason I use MyISAM is to utilize the Full-Text Search and the Spatial Indexing. Until this day, I understand that the MySQL version supported by AWS RDS still doesn't support Full-Text Search (According to this, it's for 5.6.4) and the InnoDB still doesn't support Spatial Indexing too.
So here are my questions
Let's say I convert all remaining tables that don't need the FTS & Spatial to use the InnoDB engine, how optimal can I use the features provided by AWS RDS (read replica, daily backup, etc)?
Will it be any better if I break down a table into two table, one in InnoDB and one in MyISAM? This concern came because some of the columns are often be updated, so those columns will be moved to the InnoDB one to avoid table locking. On the other hand, the MyISAM one is rarely updated.
Let's say I use separate engine for the Full Text e.g. Sphinx or Solr, how can I use it along with RDS? And is there a separate engine for Spatial Indexing that can be used along with RDS?
Any better idea?
The reason for this is that MyISAM is not considered ACID compliant. This means if that something were to happen to your database in the middle of a transaction, it could be left in an inconsistent state.
Personally, I would use full text search engine designed for the purpose. The quality of results is generally much better than what mysql provides and you can offload some of the work from your mysql server.

mySQL Indexes suggestion software

Is there any software that can analyze a mySQL query, and suggest a specific index creation.
I know its best to do it by hand, but i need to something that can save some time.
Many thanks,
The MySQL Enterprise Monitor has a Query Analyer feature. But MEM is not free.
Percona Toolkit is a free, open-source software product that gives you most of the information to do the analysis yourself.
pt-query-digest --explain analyzes the top queries that appear in your query log and shows you their current optimization plan.
pt-index-usage analyzes the queries in your query log and shows you how they are using indexes (and also shows you indexes that it considered but decided not to use).
Full disclosure: I work for Percona.
Well, this won't automate the process, but it explains how you can figure out what the best INDEX is for a given SELECT: Index Cookbook
I agree with Bill that pt-query-digest (together with the slowlog) is an excellent way to identify the "worst" queries. (Disclosure: I do not work for Percona.)

Locking DB w/ Large Reads (Ruby-on-Rails/Heroku)

Currently I have a Web API running on Heroku that is constantly writing information we're collecting from other data sources (currently theres about half a GB of data and it's growing very quickly). We're looking to add a reporting system on top of the current database that we can use to extract useful information out of the DB. The problem is that when we're running reports we're locking the DB and any other sites communicating with the DB are timing out. Does anyone have any solutions on how to solve this type of issue? Amazon RDS seems to have some interesting stuff with database replication but I don't know if that will solve my problems.
Any advice would be greatly appreciated.
Thanks
Be sure you are running innodb tables and not the old isam or myisam tables - innodb has row level locks which is much more scalable.
Make sure that you have indexes defined on all your joining/foreign keys... if you do joins without indexes it will grind. Also make sure you have indexes where appropriate for data that you search or sort on (as long as it is diverse data, not boolean or a small number of values)
Replication is another good idea, as you could target the reports at the secondary server in read-only mode, and it will just catch up once it unlocks. half a GB of data should not really be locking it up yet, so I'd look at the indexes and innodb first.
One solution to this is to have a replica of the database, so that your normal traffic goes to the master database, while long-running queries execute on the slave. I'm not sure how much control you get over the database on Heroku though, they may not support replication.
However, have you considered that the Heroku setup may be the problem here? A 500 MB database shouldn't really have performance issues unless you're performing really complex queries.
If you're happy using MySQL instead of Postgres, Engine Yard supports database replication (although generally it may not be as easy to use as Heroku).

MySQL query based replication

I wish to road-test a MySQL Cluster instance by passing it all query which are executed on InnoDB MySQL instance. I'm not too worried about data integrity on the Cluster at present, this study is focused on the stability and speed of the Cluster.
I do not wish to use statement-based binary log replication as queries which are purely SELECT will not get passed to the Cluster and so will give an incomplete view on performance.
What is the best method for implementing General Query Log based replication between MySQL instances?
Many thanks,
This is an interesting question!
There is http://www.electricmonk.nl/Programmings/MyQryReplayer , but it doesn't meet your needs, as it doesn't work online (i.e. in near real time).
you could use myqsl proxy to send the queries to both servers.
AFAIK SELECT statements are not logged in the log-bin, only UPDATES and INSERTS. The only way I know to log select queries is thru the mysql-proxy.