Skip to main content

Posts

Showing posts with the label database

classification of database indexing

Dense Index: For every records we are having one entry in the index file. Sparse Index: Only one record for each block we will have it in the index file. Primary Index ( Primary Key + Ordered Data )  A primary index is an ordered file whose records are fixed length size with 2 fields. First field is same as primary key and the second field is pointer to the data block.  Here index entry is created for first record of each block, called ‘block anchor’. Number of index entries thus are equal to number of blocks Average number of block accesses are = logB (worst case) + 1 (best case),  So on average it will be O(logB) The type of index is called sparse index because index is not created for all the records, only the first records of every block the entry is made into the index file. Example on Primary Index Number of Records = 30000, Block Size = 1024 Bytes, Strategy = Unspanned, Record Size = 100 Bytes, Key Size = 6 Bytes, Pointer Size = 9 Byt...

Turn off Auto commit in MySql

What is auto commit in mysql:  When we run DML query in mysql for example we have insert any value into table or update value in table, after each DML statement mysql auto commits the changes by default, that means we cannot rollback the changes we have made. This is called auto commit functionality. To prevent that we can stop this "auto commit " in mysql in following ways: Permanent Turing off of auto commit: Open /etc/mysql/my.cnf file in linux environment using sudo privileges as: $> sudo gedit /etc/mysql/my.cnf  and type the following lines in bottom of the file and save it. [ client ] init-command = 'set autocommit=0' then restart mysql using following command: $> sudo service mysql restart