My experience on my daily works... helping others ease each other

Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Wednesday, November 23, 2016

Running SQL Server on Linux

It has gone viral and loved by many after Microsoft declared their engagement with Linux after series of interaction... and much awaited of the possible potential running few Microsoft product running on Linux.

While waiting, lets give a try on SQL Server running on Fedora through virtual machine powered by Docker

Paul W. Frields and Langdon White share their views and step for this.
  1. https://fedoramagazine.org/run-sql-server-v-next-public-preview-fedora/
  2. https://fedoramagazine.org/sql-server-fedora-docker-container/
Share:

Wednesday, November 11, 2015

Known Limitation of MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4

It is known limitations in current releases of MySQL Cluster as compared with the features available when using the MyISAM and InnoDB storage engines. MySQL will throw errors or failed to convert does DB into supported cluster DB in MySQL (Known as NDB).

Here are the list of basic rules:

1. Do not use temporary table.

2. Do not used key (primary or foreign) that exceed 3072 bytes width (length); equivalent to 3072 characters or 3KB data

3. Do not use TEXT or BLOB as key or unique identifier or index

4. Avoid indexing FULLTEXT (such as name, address, etc)

5. Avoid using HASH column/data as key or index

6. Ensure the Auto_Increment column is also a key.

7. Ensure the foreign key is referred to a table primary or unique key.

8. Do not implement spatial indexes.

9. Used only Latin-1 character for logging

10. Avoid using READ UNCOMMITTED, REPEATABLE READ, and SERIALIZABLE. NDB only support READ COMMITTED.

11. Avoid having BLOB and TEXT as part of table column. If need to have either those two types:
  • Avoid having multiple query on same table at the same time.
  • Avoid table scan and query the entire table including the TEXT/BLOB field.
  • Avoid query the entire table using primary or unique key
  • Avoid query and extracting the TEXT/BLOB field

12. Database and table name shall not more than 63 characters.

13. Number of database, table and index in a single cluster shall not more than 20320.

14. Number of column (attributes), key and index in a single table shall not be more than 512.

15. The maximum number of row size shall not exceed 14000 bytes (14Kb).

16. Avoid using PREFIXs


Disk Data object maximums and minimums. Disk data objects are subject to the following maximums and minimums:
  1. Maximum number of tablespaces: 232 (4294967296)
  2. Maximum number of data files per tablespace: 216 (65536)
  3. Maximum data file size: The theoretical limit is 64G; however, the practical upper limit is 32G. This is equivalent to 32768 extents of 1M each.
  4. Since a MySQL Cluster Disk Data table can use at most 1 tablespace, this means that the theoretical upper limit to the amount of data (in bytes) that can be stored on disk by a single NDB table is 32G * 65536 = 2251799813685248, or approximately 2 petabytes.
  5. The theoretical maximum number of extents per tablespace data file is 216 (65536); however, for practical purposes, the recommended maximum number of extents per data file is 215 (32768).
  6. The minimum and maximum possible sizes of extents for tablespace data files are 32K and 2G, respectively. 

Sources:
  1. http://dev.mysql.com/doc/refman/5.6/en/mysql-cluster.html
  2. http://dev.mysql.com/doc/refman/5.6/en/ha-overview.html
  3. https://blogs.oracle.com/jsmyth/entry/connection_failures_between_nodes_in
  4. https://www.mysql.com/why-mysql/presentations/mysql-cluster-deployment-best-practices/
  5. http://cdn.oreillystatic.com/en/assets/1/event/36/MySQL%20Cluster%20-%20Deployment%20Best%20Practices%20Presentation.pdf
  6. http://www.clusterdb.com/tag/performance
  7. http://dba.stackexchange.com/questions/72585/problem-with-mysql-cluster-in-practice
Share:

Wednesday, November 4, 2015

MyISAM vs InnoDb - Full-text search versus Fail-safe capability

I in the midst of developing an applications for my wife to ease her daily life as lecturer and suddenly this versus thing trigger me :).


After some digging of information, I switches from InnoDb to MyISAM because I need to Full-text queries highly then insert/update process.

My conclusion:
1. Used MyISAM when your system is highly utilize for viewing and querying.
2. Used InnoDb when your system highly processing insert/update such as logging data or inserting raw data like track-and-trace system.
3. Used MyISAM if your application has the capability to roll-back or hold the data.
4. Used MyISAM if your data will grow beyond 1TB as at this point of time, query will cause problem for InnoDB.

References:
  1. http://www.thegeekstuff.com/2014/02/myisam-innodb-memory/
  2. http://dev.mysql.com/doc/refman/5.0/en/myisam-storage-engine.html
  3. http://dev.mysql.com/doc/refman/5.0/en/innodb-storage-engine.html
  4. http://tag1consulting.com/MySQL_Engines_MyISAM_vs_InnoDB#comment-115
  5. https://www.percona.com/blog/2007/01/08/innodb-vs-myisam-vs-falcon-benchmarks-part-1/
  6. http://www.rackspace.com/knowledge_center/article/mysql-engines-myisam-vs-innodb
  7. http://dba.stackexchange.com/questions/1/what-are-the-main-differences-between-innodb-and-myisam
  8. http://dba.stackexchange.com/questions/1/what-are-the-main-differences-between-innodb-and-myisam
  9. https://www.quora.com/How-are-deadlocks-resolved-in-Innodb-vs-MyISAM




Share:

Friday, December 9, 2011

Exposing Direct Database SQL Injection Attacks

SQL injection typically leverages non-validated input vulnerabilities to pass SQL commands through a Web application for execution by a backend database. Crafty attackers take advantage of SQL commands with user-provided parameters to execute arbitrary SQL queries and/or commands on the backend database server through the Web application. This video demonstration, however, shows the database being attacked directly by a non-privileged user, not through a Web application, but via direct interaction with the database.

Uploaded by on Aug 13, 2009
Share:

Tuesday, October 18, 2011

Oracle Critical Patch Update October 2011

October 18th, 2011

The Critical Patch Update for October 2011 was released on October 18th, 2011. Oracle strongly recommends applying the patches as soon as possible. Please note that Sun products are included in this Critical Patch Update.

The Critical Patch Update Advisory is the starting point for relevant information. It includes the list of products affected, pointers to obtain the patches, a summary of the security vulnerabilities for each product suite, and links to other important documents. Supported products that are not listed in the "Supported Products and Components Affected" section of the advisory do not require new patches to be applied.

Also, it is essential to review the Critical Patch Update supporting documentation referenced in the Advisory before applying patches, as this is where you can find important pertinent information.

Critical Patch Update Advisories are available at the following location:

Oracle Technology Network:
http://www.oracle.com/technetwork/topics/security/alerts-086861.html

The Critical Patch Update Advisory - October 2011 is available at the following location:

Oracle Technology Network:
http://www.oracle.com/technetwork/topics/security/cpuoct2011-330135.html

The next four Critical Patch Update expected release dates are:
  • January 17, 2012
  • April 17, 2012
  • July 17,2012
  • October 16, 2012

Share:

Thursday, September 15, 2011

Oracle Critical Patch Update - September 2011

Critical Patch Update - September 2011
Dear Oracle Security Alert Customer,

Oracle Security Alert for CVE-2011-3192 was released on September 15th, 2011.

Oracle strongly recommends applying Security Alert fixes as soon as possible.

The Security Alert Advisory is the starting point for relevant information. It includes the list of products affected, a summary of the security vulnerability, and a pointer to obtain the latest patches. Supported products that are not listed in the "Affected Products and Versions" section of the advisory do not require new patches to be applied.

Also, it is essential to review the Security Alert supporting documentation referenced in the Advisory before applying patches, as this is where you can find important pertinent information.

The Advisory is available at the following location:

Oracle Critical Patch Updates and Security Alerts
http://www.oracle.com/technology/deploy/security/alerts.html


Oracle Security Alert CVE-2011-3192
http://www.oracle.com/technetwork/topics/security/alert-cve-2011-3192-485304.html



From Oracle Security Alerts team
Share:

Wednesday, August 17, 2011

MySQL - Creating a loop in function

I was looking for foreach loop to be used in MySQL database and found a simple article written in MySQL development group. In MySQL, it does not have foreach loop but instead replace in with LOOP.

Based on that, I create my looping function and would like to share with you guys... Check it out the code below :)

DELIMITER $$

DROP FUNCTION IF EXISTS `myFunc` $$
CREATE DEFINER=`mydb`@`%` FUNCTION `myFunc`(p_id varchar(15), m_id varchar(2), q_id varchar (2), years varchar(4), r_id varchar(5), d_id varchar(10), s_id varchar(10), cws varchar(10)) RETURNS int(11)
    READS SQL DATA
BEGIN

  DECLARE done INT DEFAULT 0;
  DECLARE jsid VARCHAR(2);
  DECLARE jsd VARCHAR(100);
  DECLARE cur1 CURSOR FOR SELECT job_id, job_desc FROM mydb.t_job_sector where cws like concat(concat('%',job_id),'%');
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

  OPEN cur1;

  read_loop: LOOP
    FETCH cur1 INTO jsid, jsd;

    IF done THEN
      LEAVE read_loop;
    END IF;

    IF jsid IS NOT NULL AND jsd IS NOT NULL THEN
      INSERT INTO mydb.t_work_choice VALUES (p_id, jsid, jsd, r_id, d_id, s_id);
    END IF;

  END LOOP;

  CLOSE cur1;

  RETURN 0;
END $$

DELIMITER ;


.... hopes that helps others too....
Share:

About Me

Somewhere, Selangor, Malaysia
An IT by profession, a beginner in photography

Labels

Blog Archive

Blogger templates