Introdcution to Cassandra for RDB Folks

download Introdcution to Cassandra for RDB Folks

If you can't read please download the document

Transcript of Introdcution to Cassandra for RDB Folks

1. Cassandra for MySQL FolksSolomon [email protected] 2. Cassandra as a NoSQL platformNoSQL has been retroactively re-acronymed asNot Only SQL.Cassandra uses its own query language, CQL.CQL has many aspects of SQL, but could beconsidered a scaled down version of StructuredQuery Language. 3. Cassandra sorta looks like MySQLexcept... Databases are called Keyspaces Tables are called Column Families Port 9160 instead of 3306 Client prompt called with cqlsh instead ofmysql 4. And CQL looks kinda like SQLexcept...SQL CQLSHOW DATABASES DESCRIBE KEYSPACESCREATE DATABASE... CREATE KEYSPACE...CREATE TABLE... CREATE COLUMNFAMILY...SHOW CREATE TABLE... DESCRIBE COLUMNFAMILY... 5. And CREATE looks kinda similarexcept...CREATE COLUMNFAMILY... Never uses auto_increment Never uses NOT NULL Never uses DEFAULT Never uses array qualifiers [e.g. varchar(8)] Indexes kludged to a separate space 6. Getting used to new data typesMySQLTEXTBIGINTBLOBBITDECIMALDOUBLEFLOATINTENUMTEXTTIMESTAMPVARCHARCQLASCIIBIGINTBLOBBOOLEANCOUNTERDECIMALDOUBLEFLOATINETINTLISTMAPSETTEXTTIMESTAMPUUIDTIMEUUIDVARCHAR 7. Not all Data Types have a partner ENUM(x,y,z,etc.) DATE() DATETIME() TIME() YEAR() 8. CQL SELECTs do not: Support Joins Support aggregate functions (AVG, SUM, etc) Support expressions Seem to be satisfied with Double Quotes 9. But at least WHERE is still the sameSELECT * FROM users WHERE fname = 'Solomon';^^^^^^^^^^^^^^^^^^ Except all fields referenced by WHERE must beindexed or primary key ...And all comparisons are strictly by EQ, notGT or LT 10. InsertsINSERT syntax is almost the same, except: A conflicting PK will replace the matching entry! You have to specify your own PK value. No SELECT statements for large groups ofinserts. VALUE statements only! 11. Updates/DeletesUPDATE and DELETE are pretty much the same,except: No performing Joins on an UPDATE orDELETE WHERE clauses must reference a PK field 12. However, this frees up memory thatmight have been used on: A Join buffer A Sort bufferOr heaven forbid A query cache 13. Missing functionality offloaded toclient side Sorts: large data sets cannot use ORDER BY.They must be sorted on the client. Aggregates: the client side will have to parsethe data for records matching a certain criteriaand perform the aggregate function on it. Joins: the client side will simply have to makeadditional calls to the database for recordsmatching FKs. 14. So why use Cassandra?(Or any other NoSQL solution for that matter?) Speed Scalability 15. Cassandra for MySQL FolksSolomon [email protected]