Friday, 26 October 2018

Partitioning in MySQL


Add partition in a table

ALTER TABLE database.table_name PARTITION BY Partition_Type(Column_Name) (
PARTITION Partition_Name VALUES IN (qualify_value),
PARTITION Partition_Name VALUES IN (qualify_value)
 );

Get all detail of partitions in a database 


SELECT * FROM information_schema.partitions WHERE TABLE_SCHEMA='database'  AND PARTITION_NAME IS NOT NULL;


Select the existing record from partitioned table in MySQL 


a) SELECT * FROM database.table_name PARTITION (Partition_Name1 );
b) SELECT * FROM database.table_name PARTITION (Partition_Name1 ,Partition_Name2 );
c) SELECT * FROM database.table_name PARTITION (Partition_Name1 ,Partition_Name2 ) WHERE qualify_value='value';

Get dump of MySQL table data

MySQL dump of only single table record  data 


mysqldump -u root -PPORT_NUMBER -ppassword  --complete-insert database_name table_name > file_name.sql

MySQL dump of only multiple table record  data 


mysqldump -u root -PPORT_NUMBER -ppassword  --complete-insert database_name table_name1 table_name2 table_name3...  > file_name.sql

MySQL dump of only selected record 

mysqldump -u root -PPORT_NUMBER -ppassword database_name table_name --where="condition"

Example.

1)  mysqldump -t -u root -P3306 -ppassword school student --where="studentId=123"

                                                                   OR

   mysqldump -t -u root -ppassword school student --where="studentId=123" (without port)

2)  mysqldump -t -u root -ppassword school student --where="studentId=123 AND Name Like %sant%"

Get table size (MB) in MySQL

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
  TABLE_SCHEMA = "sma_blink"
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;

Compare two table structure in MySQL

SELECT column_name,ordinal_position,data_type,column_type FROM
(
    SELECT
        column_name,ordinal_position,
        data_type,column_type,COUNT(1) rowcount
    FROM information_schema.columns
    WHERE table_schema=DATABASE()
    AND table_name IN ('table1','table2')
    GROUP BY
        column_name,ordinal_position,
        data_type,column_type
    HAVING COUNT(1)=1
) A;

Sunday, 20 August 2017

Sunday, 1 February 2015

Fact about hashCode() in Java

Hash code method returns integer. If range of integer finishes then also two different object will have same hashCode. So it is not necessary that two different object will have same hashCode are equal.So, If the two objects have same name, then they would be equal, but still if their string field has different length, then their hashCodes will be different.
That is why, you should always use the same fields in equals and hashCode calculation.

Wednesday, 26 March 2014

Capability‬ Maturity Model (CMM)


####‪#‎Capability‬ Maturity Model (CMM)#####

--------------------------------------------------------------
The Capability Maturity Model (CMM) is a methodology used to develop and refine an organization's software development process. The model describes a five-level evolutionary path of increasingly organized and systematically more mature processes. CMM was developed and is promoted by the Software Engineering Institute (SEI), a research and development center sponsored by the U.S. Department of Defense (DoD). SEI was founded in 1984 to address software engineering issues and, in a broad sense, to advance software engineering methodologies. More specifically, SEI was established to optimize the process of developing, acquiring, and maintaining heavily software-reliant systems for the DoD. Because the processes involved are equally applicable to the software industry as a whole, SEI advocates industry-wide adoption of the CMM.

The CMM is similar to ISO 9001, one of the ISO 9000 series of standards specified by the International Organization for Standardization (ISO). The ISO 9000 standards specify an effective quality system for manufacturing and service industries; ISO 9001 deals specifically with software development and maintenance. The main difference between the two systems lies in their respective purposes: ISO 9001 specifies a minimal acceptable quality level for software processes, while the CMM establishes a framework for continuous process improvement and is more explicit than the ISO standard in defining the means to be employed to that end.

**CMM's Five Maturity Levels of Software Processes**
---------------------------------------------------------------

1. At the initial level, processes are disorganized, even chaotic. Success is likely to depend on individual efforts, and is not considered to be repeatable, because processes would not be sufficiently defined and documented to allow them to be replicated.



2. At the repeatable level, basic project management techniques are established, and successes could be repeated, because the requisite processes would have been made established, defined, and documented.


3. At the defined level, an organization has developed its own standard software process through greater attention to documentation, standardization, and integration.


4. At the managed level, an organization monitors and controls its own processes through data collection and analysis.


5. At the optimizing level, processes are constantly being improved through monitoring feedback from current processes and introducing innovative processes to better serve the organization's particular needs.