Posts

Showing posts from 2024

MySQL Query Analyzer

MySQL Select Query Analyzer Below python script will analyzes an SQL query before executing it.  It provides details such as the number of tables, joins, subqueries,  and unions in the query. Additionally, it retrieves details about  the tables involved in the query, including the table name, index name, column name, non-uniqueness, number of rows, data size, and index size.  The script also displays the MySQL explain plan for the given query.    import sqlparse import pymysql . cursors # Default Test SQL query sql_query = """ SELECT t1.id, t1.name, t2.age FROM table1 AS t1 JOIN table2 AS t2 ON t1.id = t2.id WHERE t1.name = 'John'; """ # Override default Test SQL query sql_query = input ( "Enter your SQL query: " ) # Parse the SQL query parsed = sqlparse . parse ( sql_query )[ 0 ] # Extract table names tables = set () for token in parsed . tokens : if isinstance ( token , sqlparse . sql . IdentifierList ):

Cassandra Architecture

Image
  Cassandra Architecture Cassandra was designed to address many architecture requirements. The most important requirement is to ensure there is no single point of failure. This means that if there are 100 nodes in a cluster and a node fails, the cluster should continue to operate. This is in contrast to Hadoop where the namenode failure can cripple the entire system. Another requirement is to have massive scalability so that a cluster can hold hundreds or thousands of nodes. It should be possible to add a new node to the cluster without stopping the cluster. Further, the architecture should be highly distributed so that both processing and data can be distributed. Also, high performance of read and write of data is expected so that the system can be used in real-time.      Architecture Components : Nodes and Clusters : A node is a single machine running Cassandra, and a cluster is a collection of those nodes. Data Center : A collection of related nodes, typically grouped b