Re: Delphi connection ? - Mailing list pgsql-general

From Mark Morgan Lloyd
Subject Re: Delphi connection ?
Date
Msg-id h9v5kp$fut$1@pye-srv-01.telemetry.co.uk
Whole thread Raw
In response to Re: Delphi connection ?  (John R Pierce <pierce@hogranch.com>)
List pgsql-general
John R Pierce wrote:
> Nico Callewaert wrote:

>> The thing you always hear about ODBC is, that it is very slow ?
>>
>
>
> ADO is significantly faster than ODBC, so the preferred stack would be
> delphi -> ado -> postgres ole db -> libpq ->postgres
>
> I believe there exists a delphi->ado wrapper (at least my brief googling
> popped one up)

Granted that this is a general query issue rather than one specific to
Delphi/ODBC etc., but the major speed problem that I see is where I have
a clause approximately like

WHERE now() - datetime <= '24 hours'

repeated several times in a query (e.g. in subselects or views). The
easiest solution is to replace this with a function returning an
timestamp which is evaluated once during query execution.

The moral of the story is that even if your queries are wrapped in a
fancy program generated by something like Delphi, always leave yourself
a way that you can extract a representative query after any
parameterisation and do an EXPLAIN to look for inefficiencies.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

pgsql-general by date:

Previous
From: Mark Morgan Lloyd
Date:
Subject: Re: Delphi connection ?
Next
From: Eduardo Morras
Date:
Subject: Re: Postgresql Web Hosting