From: Vlad <marchenko@gmail.com>
To: Brandon Metcalf <bmetcalf@nortel.com>
Cc: dbdpg-general@gborg.postgresql.org
Cc: pgsql-interfaces@postgresql.org
Subject: Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg
Date: Fri, 8 Apr 2005 14:40:04 -0400
Message-ID: <cd70c68105040811403321e846@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58L.0504081316270.18466@cash.rhiamet.com>
References: <Pine.LNX.4.58L.0504081127400.18466@cash.rhiamet.com>
<cd70c6810504081112694ba268@mail.gmail.com>
<Pine.LNX.4.58L.0504081316270.18466@cash.rhiamet.com>
> m> I don't know if developers of new DBD::Pg have some game plan to fix
> m> this problem... but it won't be easy: since perl is a no-var-type
> m> language, so either DBD::Pg needs to analyze the table columns data
> m> types first before executing a query and then use correct type for
> m> bind values, or let coder pass those types explicitly... though I'm
> m> not aware of a method in DBI that would let them do that...
>
> Wouldn't bind_param() do just that?
>
just looked up DBI man - you are right, bind_param accepts column type...
the question is - does DBD::Pg really process those types ?
Checkout lines
1569 ... 1576 of dbdimp.c - it only checks BYTEAOID, everything else
goes in as varchar :(
While In other place ( line 1682) it analyzes the types... It's
better to double check that with DBD::Pg developer, since I'm not
familiar with its code deeply.
Ideallly a programmer doesn't need to care to specify column type when
putting a code like this (assuming C is of an "int" type ):
my $sth = $dbh->prepare_cached( "select A from B where C=?");
$sth->execute( 123 );
...
and DBD::Pg would guess (don't ask me how) the column types and pass
it to postgresql so the query executed in most efficient way.
With DBD::Pg ver 1.40-1.41, if a programmer didn't specify a column
type, it looks like it gonna be executed by postgresql w/o using
indexes because of the bind values and table fields types conflict.
--
Vlad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: marchenko@gmail.com, bmetcalf@nortel.com, dbdpg-general@gborg.postgresql.org
Subject: Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg
In-Reply-To: <cd70c68105040811403321e846@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox