How to improve PgSql Performance using npgsql - Mailing list pgsql-sql

From Venkat Rao Tammineni
Subject How to improve PgSql Performance using npgsql
Date
Msg-id 001c01c9665b$8f007a00$ad016e00$@com
Whole thread Raw
Responses Re: How to improve PgSql Performance using npgsql
List pgsql-sql
<div class="Section1"><p class="MsoNormal"><span style="font-family:"Courier New";color:#4F81BD">Dear All,</span><p
class="MsoNormal"><spanstyle="font-family:"Courier New";color:#4F81BD"> </span><p class="MsoNormal"><span
style="font-family:"CourierNew";color:#4F81BD">  I am using   npgsql.dll to connect  postgresql database. Everything is
workingfine.but sometimes database is getting slow and even sometimes I am not getting data .I have written one
functionwhich access the data .</span><p class="MsoNormal"><span style="font-family:"Courier
New";color:#4F81BD"> </span><pclass="MsoNormal"><span style="font-family:"Courier New";color:#4F81BD">Below is my code
..</span><pclass="MsoNormal"> <p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span
style="font-size:10.0pt;font-family:"CourierNew";color:blue"> public</span><span
style="font-size:10.0pt;font-family:"CourierNew"">  <span style="color:teal">NpgsqlConnection</span>
PgSqlDataConnection()</span><pclass="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; 
font-family:"Courier New"">        {</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            <span style="color:blue">if</span> (pgSqlConnection != <span
style="color:blue">null</span>)</span><pclass="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; 
font-family:"Courier New"">            {</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">                <span style="color:blue">if</span> (pgSqlConnection.State == <span
style="color:teal">ConnectionState</span>.Open)</span><pclass="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">                {</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">                    pgSqlConnection.Close();</span><p class="MsoNormal"
style="text-autospace:none"><spanstyle="font-size:10.0pt; 
font-family:"Courier New"">                    <span style="color:green">//pgSqlConnection.Dispose();</span></span><p
class="MsoNormal"style="text-autospace:none"><span style="font-size:10.0pt; 
font-family:"Courier New"">                }</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            }</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            pgConnectionString = <span
style="color:teal">ConfigurationSettings</span>.AppSettings[<span
style="color:maroon">"ConnectionString"</span>].ToString();</span><pclass="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            pgSqlConnection = <span style="color:blue">new</span> <span
style="color:teal">NpgsqlConnection</span>(pgConnectionString);</span><pclass="MsoNormal"
style="text-autospace:none"><spanstyle="font-size:10.0pt; 
font-family:"Courier New"">            <span style="color:blue">try</span></span><p class="MsoNormal"
style="text-autospace:none"><spanstyle="font-size:10.0pt; 
font-family:"Courier New"">            {</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">                pgSqlConnection.Open();</span><p class="MsoNormal"
style="text-autospace:none"><spanstyle="font-size:10.0pt; 
font-family:"Courier New"">            }</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            <span style="color:blue">catch</span> (<span style="color:teal">Exception</span>
exp)</span><pclass="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; 
font-family:"Courier New"">            {}</span><p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;
font-family:"Courier New"">            <span style="color:blue">return</span> pgSqlConnection;</span><p
class="MsoNormal"style="text-autospace:none"><span style="font-size:10.0pt; 
font-family:"Courier New"">       }</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier
New"">      </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"; 
color:#4F81BD">Please let me where I am doing wrong.</span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"CourierNew"; 
color:#4F81BD"> </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";
color:#4F81BD">I am waiting for your great response.</span><p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"CourierNew"; 
color:#4F81BD"> </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";
color:#4F81BD">Advanced thanks.</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";
color:#4F81BD"> </span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";
color:#4F81BD">Reagrds,</span><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";
color:#4F81BD">Venkat. </span><span style="color:#4F81BD"></span></div>

pgsql-sql by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: How much the max image size can be inserted into Postgresql
Next
From: "Hilco Wijbenga"
Date:
Subject: Re: How to improve PgSql Performance using npgsql