2013-01-02 45 views
2

我需要知道使用存儲過程的優點。使用存儲過程的性能會提高

目前客戶端有3層架構。大部分表都是innodb。大多數服務器都有〜64G的ram,所有的服務器都是linux 64bit。最近他們也爲一些服務器啓動了集羣。

客戶端在db級別上了解事情更精確,而不是寫下優點和缺點。

+2

與您的問題的SQL Server部分(?)相關。 [在保存Procs與代碼中保留SQL有什麼優點和缺點](http://stackoverflow.com/questions/15142/what-are-the-pros-and-cons-to-keeping-sql-in-stored -procs抗代碼) –

回答

1

3層將優化資源利用率並大幅改善您的程序。當你在大型應用程序中構建簡單的應用程序時,你會感覺不到,你會明顯感覺到不同。例如,看看如何使用這3層,看看其中的差異。

public class businesscheck 
{ 
    datacheck dldata = new datacheck(); 

    public int PeronalDetails(int bh, string bse, string bt, string bde) 
    { 
     string sql = "[dbo].[newsinsert]"; 
     int bheader = bheaderid + 1; 
     int result = dldata.SQLSP(sql, bheader, bsubtype, btitle, bdescr); 
     return result; 
    } 

    public void deleterecord(int a) 
    { 
     dldata.SQLC(); 
    } 
} 

後來終於當你從你的前層的系統調用此可以很容易地通過價值觀和程序員和設計師都可以單獨控制。

protected void Button1_Click(object sender, EventArgs e) 
    { 

     int MyInteger = Convert.ToInt32(TextBox1.Text); 
     string subtype = txt2.Text; 


     obj1.PeronalDetails(header, subtype, title, desc); 

     txt2.Text = ""; 

    }