Обсуждение: Npsql is much faster than ODBC ?

Поиск
Список
Период
Сортировка

Npsql is much faster than ODBC ?

От
一首诗
Дата:
Hi all,

Recently I found my C/S program becomes slow.  So I analysed the tcp
traffic between my program and the Postgresql database.  I found there
are occasionally tcp re-transmission and that's why my porgram slow
down.

But when I changed to npsql,  the tcp traffic was cut off to only 1/4
and there are much fewer re-transmission.  I am not sure it's the
problem of odbc or it's because that I am using odbc correctly.


Re: Npsql is much faster than ODBC ?

От
Ilan Volow
Дата:
I've never used Npsql and I'm not a C# developer (so take this response with more than a few grains of salt) but from what I remember reading somewhere, Npsql implements postgres protocols natively, with the protocol handling done directly in C# and getting the raw data without going through any other software layers (such as other interfaces that wrap libpq). There are several layers of software between an application speaking ODBC and a PostgreSQL server, and you'll probably get a speed hit going through each of those layers. 

-- Ilan

On Nov 5, 2007, at 10:42 AM, 一首诗 wrote:

Hi all,

Recently I found my C/S program becomes slow.  So I analysed the tcp
traffic between my program and the Postgresql database.  I found there
are occasionally tcp re-transmission and that's why my porgram slow
down.

But when I changed to npsql,  the tcp traffic was cut off to only 1/4
and there are much fewer re-transmission.  I am not sure it's the
problem of odbc or it's because that I am using odbc correctly.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

Ilan Volow
"Implicit code is inherently evil, and here's the reason why:"



Re: Npsql is much faster than ODBC ?

От
Alvaro Herrera
Дата:
????????? wrote:
> Hi all,
>
> Recently I found my C/S program becomes slow.  So I analysed the tcp
> traffic between my program and the Postgresql database.  I found there
> are occasionally tcp re-transmission and that's why my porgram slow
> down.
>
> But when I changed to npsql,  the tcp traffic was cut off to only 1/4
> and there are much fewer re-transmission.  I am not sure it's the
> problem of odbc or it's because that I am using odbc correctly.

FYI there's another Postgres ODBC driver that is said to have better
performance.

https://projects.commandprompt.com/public/odbcng

(Yes, my company maintains it)

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Npsql is much faster than ODBC ?

От
Rainer Bauer
Дата:
Alvaro Herrera wrote:

>FYI there's another Postgres ODBC driver that is said to have better
>performance.
>
>https://projects.commandprompt.com/public/odbcng
>
>(Yes, my company maintains it)

psqlodbc is licenced under LGPL, but ODBCng uses the GPL.

That means that commercial software cannot use the ODBCng driver. Are there
any plans to release it under LGPL licence?

Rainer

Re: Npsql is much faster than ODBC ?

От
"Joshua D. Drake"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 06 Nov 2007 22:03:52 +0100
Rainer Bauer <usenet@munnin.com> wrote:

> Alvaro Herrera wrote:
> 
> >FYI there's another Postgres ODBC driver that is said to have better
> >performance.
> >
> >https://projects.commandprompt.com/public/odbcng
> >
> >(Yes, my company maintains it)
> 
> psqlodbc is licenced under LGPL, but ODBCng uses the GPL.
> 
> That means that commercial software cannot use the ODBCng driver. Are
> there any plans to release it under LGPL licence?

The only time this would be an issue is if you tried to embed the
driver. Other than that, you are more than welcome to use closed source
software against the ODBCng driver.

Joshua D. Drake


> 
> Rainer
> 
> ---------------------------(end of
> broadcast)--------------------------- TIP 3: Have you checked our
> extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 


- -- 

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997  http://www.commandprompt.com/
            UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHMRG8ATb/zqfZUUQRAib0AJ9kti8nA36Q6slwtDS6/wJ5u80AVACdFXnD
HW8SjKOz/hDbCpmd0FFiO34=
=JHH/
-----END PGP SIGNATURE-----

Re: Npsql is much faster than ODBC ?

От
Rainer Bauer
Дата:
"Joshua D. Drake" wrote:

>> psqlodbc is licenced under LGPL, but ODBCng uses the GPL.
>>
>> That means that commercial software cannot use the ODBCng driver. Are
>> there any plans to release it under LGPL licence?
>
>The only time this would be an issue is if you tried to embed the
>driver. Other than that, you are more than welcome to use closed source
>software against the ODBCng driver.

That's nice to hear. But I respect licences as they are and the ODBCng driver
is licenced under the GPL.

So is this an _official_ statement from CommandPrompt that the driver can be
used in commercial applications? If so then either this should be stated on
the drivers' page (or the licence should be changed to LGPL).

Rainer

Re: Npsql is much faster than ODBC ?

От
"Joshua D. Drake"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 07 Nov 2007 02:40:08 +0100
Rainer Bauer <usenet@munnin.com> wrote:

> 
> That's nice to hear. But I respect licences as they are and the
> ODBCng driver is licenced under the GPL.
> 
> So is this an _official_ statement from CommandPrompt that the driver
> can be used in commercial applications? If so then either this should
> be stated on the drivers' page (or the licence should be changed to
> LGPL).

The official statement is, you can use it in commercial applications as
long as you don't violate the GPL.

Sincerely,

Joshua D. Drake



- -- 

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997  http://www.commandprompt.com/
            UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHMRrEATb/zqfZUUQRAoSHAJ4nfRd578obPDtvXgLY2L4LiJvyeACgqN84
CCBwO5pCIOO2NIQiiHcq80U=
=Z1yA
-----END PGP SIGNATURE-----

Re: Npsql is much faster than ODBC ?

От
"Andrej Ricnik-Bay"
Дата:
On Nov 7, 2007 2:40 PM, Rainer Bauer <usenet@munnin.com> wrote:

> That's nice to hear. But I respect licences as they are and the ODBCng driver
> is licenced under the GPL.
That doesn't mean that you're not allowed to use it with commercial
applications;  it just means that you need to be happy to provide the
source for it on request.

> Rainer
Cheers,
Andrej

--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

Re: Npsql is much faster than ODBC ?

От
"Peter Cai"
Дата:
Thanks.  I have tried your program.  But it seems that it has trouble with EUC_CN.
It returns unrecoginzed value of empty columns.

BTW: I've solved this problem.  Every one using odbc on windows shuold read this mail:


  psqlODBC with Visual Studio 2005 and Connection Pooling for newbies

On Nov 7, 2007 4:48 AM, Alvaro Herrera < alvherre@commandprompt.com> wrote:
????????? wrote:
> Hi all,
>
> Recently I found my C/S program becomes slow.  So I analysed the tcp
> traffic between my program and the Postgresql database.  I found there
> are occasionally tcp re-transmission and that's why my porgram slow
> down.
>
> But when I changed to npsql,  the tcp traffic was cut off to only 1/4
> and there are much fewer re-transmission.  I am not sure it's the
> problem of odbc or it's because that I am using odbc correctly.

FYI there's another Postgres ODBC driver that is said to have better
performance.

https://projects.commandprompt.com/public/odbcng

(Yes, my company maintains it)

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



--
古希腊有一种哲人,穿着很宽的袍子走来走去。他们会划优美的曲线,其中包含了自己全部的心胸。他们的朋友也是智者,只有智者们互相之间才能明白彼此的曲线彼此的心胸。

Re: Npsql is much faster than ODBC ?

От
Rainer Bauer
Дата:
"Andrej Ricnik-Bay" wrote:

>On Nov 7, 2007 2:40 PM, Rainer Bauer <usenet@munnin.com> wrote:
>
>> That's nice to hear. But I respect licences as they are and the ODBCng driver
>> is licenced under the GPL.
>That doesn't mean that you're not allowed to use it with commercial
>applications;  it just means that you need to be happy to provide the
>source for it on request.

Which is exactly the reason why the LGPL licence was created. So that any
software can link against  a library without the restrictions of the GPL.

Rainer

odbcng

От
Sam Mason
Дата:
On Tue, Nov 06, 2007 at 05:48:12PM -0300, Alvaro Herrera wrote:
> FYI there's another Postgres ODBC driver that is said to have better
> performance.
>
> https://projects.commandprompt.com/public/odbcng
>
> (Yes, my company maintains it)

Are there any known issues when calling it from VB?  I've got a VB (MS
Access) client that uses PG as its backend and it seems to die horribly
when doing any sort of query that returns a text column.  This happens
through either DAO or ADO; though DAO gives the error "the size of a
field is too long", ADO just segfaults.

For example, the following code doesn't work for me.  Looks like the
sort of thing that that should get lots of test coverage so maybe it's
something on my system.

  Public Sub test()
    Dim con As ADODB.Connection, rs As ADODB.Recordset

    Set con = New ADODB.Connection
    con.Open "DSN=badgerstudy"

    Set rs = con.Execute("SELECT 1, 'foo'::TEXT, 'bar'")

    While Not rs.EOF
      rs.MoveNext
    Wend
  End Sub


Thanks,
  Sam

Re: Npsql is much faster than ODBC ?

От
Alvaro Herrera
Дата:
Rainer Bauer wrote:
> "Andrej Ricnik-Bay" wrote:
>
> >On Nov 7, 2007 2:40 PM, Rainer Bauer <usenet@munnin.com> wrote:
> >
> >> That's nice to hear. But I respect licences as they are and the ODBCng driver
> >> is licenced under the GPL.
> >That doesn't mean that you're not allowed to use it with commercial
> >applications;  it just means that you need to be happy to provide the
> >source for it on request.
>
> Which is exactly the reason why the LGPL licence was created. So that any
> software can link against  a library without the restrictions of the GPL.

Keep in mind, though, that the ODBC driver is not linked to your app.
It is only loaded on demand at run time, and can be replaced by any
other ODBC driver.   So AFAIU your application is "shielded" from GPL.
IANAL of course.  Saith the GPL:

  These requirements apply to the modified work as a whole.  If
  identifiable sections of that work are not derived from the Program,
  and can be reasonably considered independent and separate works in
  themselves, then this License, and its terms, do not apply to those
  sections when you distribute them as separate works.
  [...]
  In addition, mere aggregation of another work not based on the Program
  with the Program (or with a work based on the Program) on a volume of
  a storage or distribution medium does not bring the other work under
  the scope of this License.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Re: odbcng

От
Andrei Kovalevski
Дата:
Hello,

This query works for me on Access 2003. Which versions of Access and
ODBCng you have?
We can communicate via odbcng@lists.commandprompt.com
<mailto:odbcng@lists.commandprompt.com>. I'll try to help you with any
problems.

Sam Mason wrote:
> On Tue, Nov 06, 2007 at 05:48:12PM -0300, Alvaro Herrera wrote:
>
>> FYI there's another Postgres ODBC driver that is said to have better
>> performance.
>>
>> https://projects.commandprompt.com/public/odbcng
>>
>> (Yes, my company maintains it)
>>
>
> Are there any known issues when calling it from VB?  I've got a VB (MS
> Access) client that uses PG as its backend and it seems to die horribly
> when doing any sort of query that returns a text column.  This happens
> through either DAO or ADO; though DAO gives the error "the size of a
> field is too long", ADO just segfaults.
>
> For example, the following code doesn't work for me.  Looks like the
> sort of thing that that should get lots of test coverage so maybe it's
> something on my system.
>
>   Public Sub test()
>     Dim con As ADODB.Connection, rs As ADODB.Recordset
>
>     Set con = New ADODB.Connection
>     con.Open "DSN=badgerstudy"
>
>     Set rs = con.Execute("SELECT 1, 'foo'::TEXT, 'bar'")
>
>     While Not rs.EOF
>       rs.MoveNext
>     Wend
>   End Sub
>
>
> Thanks,
>   Sam
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

Thanks,
Andrei.

Re: Npsql is much faster than ODBC ?

От
Rainer Bauer
Дата:
Alvaro Herrera wrote:

>Rainer Bauer wrote:
>> "Andrej Ricnik-Bay" wrote:
>>
>> >On Nov 7, 2007 2:40 PM, Rainer Bauer <usenet@munnin.com> wrote:
>> >
>> >> That's nice to hear. But I respect licences as they are and the ODBCng driver
>> >> is licenced under the GPL.
>> >That doesn't mean that you're not allowed to use it with commercial
>> >applications;  it just means that you need to be happy to provide the
>> >source for it on request.
>>
>> Which is exactly the reason why the LGPL licence was created. So that any
>> software can link against  a library without the restrictions of the GPL.
>
>Keep in mind, though, that the ODBC driver is not linked to your app.
>It is only loaded on demand at run time, and can be replaced by any
>other ODBC driver.   So AFAIU your application is "shielded" from GPL.
>IANAL of course.

Neither am I.

However, the GPL FAQ has an entry specially for this case:
<http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins>

"If the program dynamically links plug-ins, and they make function calls to
each other and share data structures, we believe they form a single program,
which must be treated as an extension of both the main program and the
plug-ins. In order to use the GPL-covered plug-ins, the main program must be
released under the GPL or a GPL-compatible free software license, and that the
terms of the GPL must be followed when the main program is distributed for use
with these plug-ins."

The way I read this section is that linking to a GPL ODBC driver would imply
that I have to release my program under a GPL  (compatible) licence.

This was one of the reasons why I added Postgres support to my program instead
of MySQL [1]. They altered the licence for their drivers from LGPL to GPL so
that you have to purchase a commercial licence.

Rainer

[1] In the meantime I am of course glad that I made this decision. I have not
only learned a lot more about databases, but especially that Postgres is
superior to MySQL ;-)

Re: Npsql is much faster than ODBC ?

От
Greg Smith
Дата:
On Wed, 7 Nov 2007, Rainer Bauer wrote:

> The way I read this section is that linking to a GPL ODBC driver would imply
> that I have to release my program under a GPL  (compatible) licence.

What you actually link against is the ODBC implementation for your
platform.  If you're on something UNIX-ish, you're probably linking
against unixODBC, which is available under the LGPL presumably to avoid
this issue.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

Re: Npsql is much faster than ODBC ?

От
Andrei Kovalevski
Дата:
Rainer Bauer wrote:
> Alvaro Herrera wrote:
>
>
>> Rainer Bauer wrote:
>>
>>> "Andrej Ricnik-Bay" wrote:
>>>
>>>
>>>> On Nov 7, 2007 2:40 PM, Rainer Bauer <usenet@munnin.com> wrote:
>>>>
>>>>
>>>>> That's nice to hear. But I respect licences as they are and the ODBCng driver
>>>>> is licenced under the GPL.
>>>>>
>>>> That doesn't mean that you're not allowed to use it with commercial
>>>> applications;  it just means that you need to be happy to provide the
>>>> source for it on request.
>>>>
>>> Which is exactly the reason why the LGPL licence was created. So that any
>>> software can link against  a library without the restrictions of the GPL.
>>>
>> Keep in mind, though, that the ODBC driver is not linked to your app.
>> It is only loaded on demand at run time, and can be replaced by any
>> other ODBC driver.   So AFAIU your application is "shielded" from GPL.
>> IANAL of course.
>>
>
> Neither am I.
>
> However, the GPL FAQ has an entry specially for this case:
> <http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins>
>
> "If the program dynamically links plug-ins, and they make function calls to
> each other and share data structures, we believe they form a single program,
> which must be treated as an extension of both the main program and the
> plug-ins. In order to use the GPL-covered plug-ins, the main program must be
> released under the GPL or a GPL-compatible free software license, and that the
> terms of the GPL must be followed when the main program is distributed for use
> with these plug-ins."
>

ODBC drivers are loaded by ODBC driver manager - which is also
dinamically linked library. Application calls functions from Driver
Manager, and then manager goes farther to the driver's level of
abstraction. Driver has no information about the parent application, and
can't call any functions from it. Driver is not a plug-in, and
application doesn't have to worry about its existance.

> The way I read this section is that linking to a GPL ODBC driver would imply
> that I have to release my program under a GPL  (compatible) licence.
>
> This was one of the reasons why I added Postgres support to my program instead
> of MySQL [1]. They altered the licence for their drivers from LGPL to GPL so
> that you have to purchase a commercial licence.
>
> Rainer
>
> [1] In the meantime I am of course glad that I made this decision. I have not
> only learned a lot more about databases, but especially that Postgres is
> superior to MySQL ;-)
>

Thanks,
Andrei.

Re: Npsql is much faster than ODBC ?

От
Rainer Bauer
Дата:
Greg Smith wrote:

>On Wed, 7 Nov 2007, Rainer Bauer wrote:
>
>> The way I read this section is that linking to a GPL ODBC driver would imply
>> that I have to release my program under a GPL  (compatible) licence.
>
>What you actually link against is the ODBC implementation for your
>platform.  If you're on something UNIX-ish, you're probably linking
>against unixODBC, which is available under the LGPL presumably to avoid
>this issue.

My program runs under MS Windows only. Which means the Microsoft ODBC "driver
manager" is closed source.

I have found the original announcement from CommandPrompt and it seems that
this topic  was already discussed before:
<http://archives.postgresql.org/pgsql-odbc/2005-04/msg00084.php>

Rainer