Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, September 26, 2014

MySQL Spatial Queries

http://howto-use-mysql-spatial-ext.blogspot.ca/

org.hibernate.dialect.MySQLDialect
MySQL5Dialect, MySQLInnoDBDialect, MySQLMyISAMDialect
 https://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/dialect/MySQLDialect.html

drop table test;

create table test (
    id INT NOT NULL PRIMARY KEY,
    location LINESTRING NOT NULL,
    SPATIAL KEY sx_location (location)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

set @a = linestring(point(1,1),point(5,1));
set @b = linestring(point(1,1),point(10,1));

insert into test values(1, @a);
insert into test values(2, @b);

select * from test where MBRtouches(location, linestring(point(1,1),point(5,1)) );
select * from test where MBRtouches(location, linestring(point(2,1),point(3,1)) );
select * from test where MBRtouches(location, linestring(point(1,1),point(2,1)) );
select * from test where MBRtouches(location, linestring(point(1,1),point(7,1)) );
select * from test where MBRtouches(location, linestring(point(-1,1),point(0,1)) );
select * from test where MBRtouches(location, linestring(point(0,1),point(1,1)) );
select * from test where MBRtouches(location, linestring(point(7,1),point(12,1)) );
select * from test where MBRtouches(location, linestring(point(12,1),point(20,1)) );

select MBRcontains(@b,@a);
select MBRcontains(@a,@b);
select MBRoverlaps(@a,@b);
select MBRoverlaps(@b,@a);
select MBRtouches(@a,@b);

Thursday, January 16, 2014

SQL EXPLAIN to analyse and improve SQL queries

Database SQL query is slow?

You can use MySQL's EXPLAIN to analyse the query, maybe the column of the WHERE clause needs to be indexed?

EXPLAIN SELECT tt.TicketNumber, tt.TimeIn,
               tt.ProjectReference, tt.EstimatedShipDate,
               tt.ActualShipDate, tt.ClientID,
               tt.ServiceCodes, tt.RepetitiveID,
               tt.CurrentProcess, tt.CurrentDPPerson,
               tt.RecordVolume, tt.DPPrinted, et.COUNTRY,
               et_1.COUNTRY, do.CUSTNAME
        FROM tt, et, et AS et_1, do
        WHERE tt.SubmitTime IS NULL
          AND tt.ActualPC = et.EMPLOYID
          AND tt.AssignedPC = et_1.EMPLOYID
          AND tt.ClientID = do.CUSTNMBR;

http://dev.mysql.com/doc/refman/5.0/en/explain-output.html


mysql> alter table MY_TABLE add INDEX IDX_F1_F2 (F1,F2);
mysql> SHOW INDEX FROM MY_TABLE;

http://devzone.advantagedatabase.com/dz/webhelp/advantage9.1/how_indexes_are_used_by_the_where_clause.htm

http://www.experts-exchange.com/Database/MySQL/A_1250-3-Ways-to-Speed-Up-MySQL.html 

Tuesday, July 9, 2013

Debug hibernate

production-data-source.xml <property name="show_sql">true</property>
hibernate.cfg.xml  <property name="show_sql">true</property>

Tuesday, April 30, 2013

Limiting the number of records from mysqldump?

http://stackoverflow.com/questions/135835/limiting-the-number-of-records-from-mysqldump

mysqldump -h hostname -u user --quick --where="1 limit 1000000" myDatabase > out.sql


mysql --force -h hostname -u user --password=password myDatabase < out.sql

Monday, April 29, 2013

J2EE AndroMDA (Model driven Architecture)

http://myjeeva.com/how-to-create-java-j2ee-project-using-mda-tool-andromda.html

AndroMDA (pronounced as “Andromeda”) is an extensible generator framework that adheres to theModel Driven Architecture (MDA) paradigm.  It transforms UML models into deployable components forJava/J2EE & Microsoft .NET; using AndroMDA means one main thing:write less code.  Not only that, AndroMDA also lets you create better applications and maintain order on large projects.  AndroMDA enforces best practices and lets developers focus on high level problems.

Thursday, August 16, 2012

OpenMRS (Open Medical Record System)

http://sourceforge.net/projects/openmrs/

OpenMRS is a community-developed, open source, enterprise electronic medical record system. Our mission is to improve health care delivery in resource-constrained environments by coordinating a global community to creates and support this software.

Monday, December 20, 2010

noSQL

Casandra
Mongo
Dynamo
Amazon Simple DB
Google BigTable
javaCC - Query graph model (QGM)

http://en.wikipedia.org/wiki/NoSQL

Tuesday, December 7, 2010

Foreign Key Constraints

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

mysql> SET foreign_key_checks = 0;
mysql> SOURCE dump_file_name;
mysql> SET foreign_key_checks = 1;

Friday, September 24, 2010

SQLite Manager for Firefox

https://addons.mozilla.org/en-US/firefox/addon/5817/

Thursday, September 16, 2010

About the ALEXA-Seq data viewer

About the ALEXA-Seq data viewer

The following is a list of utilities and resources used to create the ALEXA-Seq visualization tool:

Figures and statistics: The R Project and Bioconductor

Scalable Vector Graphics was chosen as the image format: XML Graphics for the Web

General web programming: Perl

Database management systems: MySQL and Berkeley DB

Web animation java-script used to give the viewer a 'Web 2.0' style: Google AJAX APIs and Dynamic Drive

Indexing and search functionality: The Xapian Project and Omega

Web traffic analysis: Google Analytics