From: | Vlad <marchenko(at)gmail(dot)com> |
---|---|
To: | Brandon Metcalf <bmetcalf(at)nortel(dot)com> |
Cc: | dbdpg-general(at)gborg(dot)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg |
Date: | 2005-04-08 18:40:04 |
Message-ID: | cd70c68105040811403321e846@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | David Stanaway | 2005-04-08 18:44:46 | Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg |
Previous Message | Brandon Metcalf | 2005-04-08 18:17:23 | Re: [Dbdpg-general] benchmarking old Pg and DBD::Pg |