기본 콘텐츠로 건너뛰기

[DB] B트리와 Binary트리의 성능 차이

출처:http://stackoverflow.com/questions/6211118/b-trees-vs-binary-trees 4 down vote Algorithmic complexity is the same, since O(log b n) = O(c log n) = O(log n) but the constant factors are hugely different. B-trees were designed for platter hard disks, which have a huge access time (moving the head into position) after which an entire physical sector is read. Making the B-tree nodes as large as the sector minimizes the number of access times and maximizes the useful data out of each read operation. But if you are working out of memory (or SSD) you have a negligible access time, therefore a better comparison is to count the number of single words accessed. For example, let's plan a data structure to store 2 20 keys of 1 word each, for a total of 4MiB of raw data on a 32bit machine. A "beefy" B-tree, made for contemporary hard disks, will have 4kiB nodes, which can hold up to 512 keys and pointers (...

[DB] 데이터베이스 성능 최적화 인덱스는 필요악이다

출처: http://juin100.blogspot.kr/2010/01/mysql%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%84%B1%EB%8A%A5-%EC%B5%9C%EC%A0%81%ED%99%94-%EC%9D%B8%EB%8D%B1%EC%8A%A4%EB%8A%94-%ED%95%84%EC%9A%94%EC%95%85%EC%9D%B4%EB%8B%A4.html [MYSQL]데이터베이스 성능 최적화 인덱스는 필요악이다 우리는 데이터베이스의 데이터를 액세스하기 위해 SQL을 사용하게 된다. SQL을 수행하면서 해당 SQL의 성능 향상을 위해 인덱스를 생성하는 경우가 다반사일 것이다. 이와 같이 인덱스는 성능 향상을 위해 매우 중요한 역할을 수행하게 된다. 하지만, 많은 곳에서는 성능 향상을 위한 중요한 인덱스를 잘못 이용하는 경우가 많다. SQL의 성능 향상을 위한 중심에는 인덱스가 존재한다. 이제부터 인덱스의 정확한 이해를 통해 성능 향상을 계획해야 할 것이다.   권순용 | kwontra@hanmail.net     수 많은 프로젝트에서 프로그램을 개발하면서 해당 프로그램에 필요한 인덱스를 생성하고 인덱스를 이용하여 성능 향상을 계획하는 사이트를 많이 보아왔다. 하지만, 많은 사이트에서 인덱스의 잘못된 선정으로 성능 문제가 발생하고 이로 인해 많은 고통을 경험하는 것을 수없이 많이 보아 왔다. 도대체 인덱스에는 어떠한 비밀이 존재하기 때문에 우리는 SQL을 위해 인덱스를 생성하고 성능 저하를 경험해야 하는 것인가? 이는 우리가 인덱스에 대해 두 가지의 잘못된 사실을 진실로 간주하기 때문이다. 이제부터 인덱스의 잘못된 두 가지 사실에 대해 정확히 파헤쳐 보자.     인덱스는 무엇인가?     나 를 알고 적을 안다면 100전 100승이라고 했던가? 따라서, 인덱스를 효과적으로 이용하기 위해서는 인덱스에 대한 정확한 이해...

[자바] DATE, Calendar 객체 사용 예제

출처:  http://blog.naver.com/PostView.nhn?blogId=pullpopo&logNo=40057609658&parentCategoryNo=23&viewDate=&currentPage=1&listtype=0 [ 날짜 연산법 ] 1. 시스템의 밀리초 구하기.(국제표준시각(UTC, GMT) 1970/1/1/0/0/0 으로부터 경과한 시각) ------------------------------------------------------------------ // 밀리초 단위(*1000은 1초), 음수이면 이전 시각 long time = System.currentTimeMillis ( );  System.out.println ( time.toString ( ) );  ------------------------------------------------------------------ 2. 현재 시각을 가져오기. ------------------------------------------------------------------ Date today = new Date ();  System.out.println ( today ); 결과 : Sat Jul 12 16:03:00 GMT+01:00 2000 ------------------------------------------------------------------ 3. 경과시간(초) 구하기 ------------------------------------------------------------------ long time1 = System.currentTimeMillis ();  long time2 = System.currentTimeMillis (); system.out.println ( ( time2 - time1 ) / 1000.0 ); ---------------------------...

[Sencha Touch] How to install Sencha Touch Cmd on Ubuntu, Linux

source:  http://www.icodeya.com/2012/12/installing-sencha-touch-201-on-ubuntu.html I change a few confusing and wrong parts. (Thanks anyway, you-who-wrote-this-great-post) For this tutorial, I used the following  Ubuntu 11.10 (Oneiric) Sencha CMD v3.0.0.250 Sencha Touch 2.0.1-gpl Apache Tomcat (I'm using Apache/2.2.20 with Tomcat 6) Be sure to download the Sencha Touch SDK and the Sencha Touch CMD, and be sure to download the ones for linux! According to some sources, Sencha Touch 2.1 is no longer using Sencha SDK Tools but using Sencha CMD instead as of writing time. You might want to  read about it ! :D  After downloading the 2 files. They're gonna look something like the screenshot below. The Sencha Touch SDK is a simple zip file, while the CMD is a runnable zip file. Step 1  Unzip Sencha Touch 2.0.1-gpl.war to /var/www/ folder. If you get a permission error, simply unzip it in it's current folder and do a sudo cp like the one below:  sud...

[python] Understanding Python Decorators in 12 Easy Steps!

source:  http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ Blog  :: Understanding Python Decorators in 12 Easy Steps! 1 July 2012 Ok, perhaps I jest. As a Python instructor, understanding decorators is a topic I find students consistently struggle with upon first exposure. That’s because decorators are hard to understand!  Getting  decorators requires understanding several functional programming concepts as well as feeling comfortable with some unique features of Python’s function definition and function calling syntax. *Using* decorators is easy (see  Section 10 )! But writing them can be complicated. I can’t make decorators easy - but maybe by walking through each piece of the puzzle one step at a time I can help you feel more confident in understanding decorators [1] . Because decorators are complex this is going to be a long article - but stick with it! I promise to make each piece as simple as possible - and if you understan...