Big than 4G datafile can user Myisam merge table.
// query cache does NOT work
$r = mysql_query("SELECT username FROM user WHERE signup_date >= CURDATE()");
// query cache works!
$today = date("Y-m-d");
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '$today'");
t is a good habit to always specify which columns you need when you are doing your SELECT’s.
Vertical Partitioning is the act of splitting your table structure in a vertical manner for optimization reasons.
Example 1: You might have a users table that contains home addresses, that do not get read often. You can choose to split your table and store the address info on a separate table. This way your main users table will shrink in size. As you know, smaller tables perform faster.
Example 2: You have a “last_login” field in your table. It updates every time a user logs in to the website. But every update on a table causes the query cache for that table to be flushed. You can put that field into another table to keep updates to your users table to a minimum.
But you also need to make sure you don’t constantly need to join these 2 tables after the partitioning or you might actually suffer performance decline.
If you have some kind of maintenance script that needs to delete large numbers of rows, just use the LIMIT clause to do it in smaller batches to avoid this congestion.
f you do not need the time component, use DATE instead of DATETIME.
refer :
http://blog.tuvinh.com/top-20-mysql-best-practices/
PreparedStatements are implemented by the driver, as MySQL
does not have a prepared statement feature. Because of this,
the driver does not implement
getParameterMetaData()
or
getMetaData()
as it would require the
driver to have a complete SQL parser in the client.
Starting with version 3.1.0 MySQL Connector/J, server-side prepared statements and binary-encoded result sets are used when the server supports them.
Employee boss("Morris, Melinda", 83000);
Employee* s = &boss;
This is usually not a good idea. As a rule of thumb, C++ pointers should only refer to objects allocated wth new.
聲明,因?yàn)閏++這種語言,在使用函數(shù)和變量的時(shí)候,必須將他聲明,為何要聲明?聲明之后才
知道他的規(guī)格,才能更好的發(fā)現(xiàn)不和規(guī)格的部分.你別妄想一個(gè)編譯單元,會(huì)自動(dòng)從另一個(gè)
編譯單元那里得到什么信息,知道你是如何定義這個(gè)函數(shù)的.
所以說,只要使用到該函數(shù)的單元,就必須寫一份聲明在那個(gè).cpp里面,這樣是不是很麻煩,
而且,如果要修改,就必須一個(gè)一個(gè)修改.這真讓人受不了.
.h就是為了解決這個(gè)問題而誕生,他包含了這些公共的東西.然后所有需要使用該函數(shù)的.cpp,只需要
用#include包含進(jìn)去便可.以后需要修改,也只是修改一份內(nèi)容.
請(qǐng)注意不要濫用.h,.h里面不要寫代碼,.h不是.cpp的倉(cāng)庫(kù),什么都塞到里面.
如果在里面寫代碼,當(dāng)其他.cpp包含他的時(shí)候,就會(huì)出現(xiàn)重復(fù)定義的情況,
比如將函數(shù)func(){printf};放到頭文件a.h,里面還有一些a.cpp需要的聲明等;
然后你發(fā)現(xiàn)b.cpp需要用到a.cpp里面的一個(gè)函數(shù),就很高興的將a.h包含進(jìn)來.
注意,#include并不是什么申請(qǐng)指令,他就是將指定的文件的內(nèi)容,原封不動(dòng)的拷貝
進(jìn)來.
這時(shí)候?qū)嶋H上a.cpp和b.cpp都有一個(gè)func()函數(shù)的定義.
如果這個(gè)函數(shù)是內(nèi)部鏈接static的話,還好,浪費(fèi)了一倍空間;
如果是extern,外部鏈接(這個(gè)是默認(rèn)情況),那么根據(jù)在同一個(gè)程序內(nèi)不可出現(xiàn)
同名函數(shù)的要求,連接器會(huì)毫不留情給你一個(gè)連接錯(cuò)誤!
http://www.cnblogs.com/shelvenn/archive/2008/02/02/1062446.html
Platform二. Philosophy and discipline
Kernel
Framework
Be aware of context三. Principle
Extreme maintenance
Be pragmatic
Extreme abstract: Program to an interface (abstraction), not an implementation
Extreme separation of concerns
Extreme readability
Testability
No side effect
Do not repeat yourself
DIP ,dependency inversion of control四. design pattern
OCP , open close
LSP , liskov substitute
ISP , interface segregation
SRP , single responsibility
LKP, Lease knowledge principle
Construction
Behavior
Structure
Long method六. algorithms
Diverse change
Repeated code
Talk to stranger
Pre optimize
nLongN
Divided and conqueror
Hierarchal
Pipes and filter
Micro kernel
Broker
Black Board
Interpreter
What to concurrent九. languages
Scalability
Stretch key dimensions to see what breaks
Ruby十. Performance
Erlang
assemble
C
C++
Java
Python
Scala
Be ware of different program paradigms.
Minimize remote calls and other I/O
Speed-up data conversion
release resource as soon as possible
軟件設(shè)計(jì)思想的發(fā)展邏輯,大致是提高抽象程度 ,separation of concern 程度。十二. Reference
fn(design )= fn1(abstraction )+ fn2(separation of concern).
由于大規(guī)模數(shù)據(jù)處理時(shí)代的來臨,下一代設(shè)計(jì)范式的重點(diǎn):
1. 將是如何提高distributed(--concurrent) programing 的抽象程度 和 separation of concern 程度。
2. dsl ,按照以上的公式,也確實(shí)是一個(gè)好的方向。
<art agile software development>
<prerefactor>
<design patterns>
<beautiful architecture>
<refactor>
<pattern oriented software architecture>
<extreme software development>
<beautiful code>
<patterns for parallel programming>
<java concurrent programming in practice>
<java performance tuning>
<the definite guide to hadoop>
<greenplum>
<DryadLINQ>
<software architecture in practice>
<97 things architecture should known>
http://en.wikipedia.org/wiki/Programming_paradigm