-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hard to imagine it taking that long, even for a table that large,
but we don't know the details of your system. I got a sample
table with 800,000 records down to 92 seconds using the function
below. See how it does for you. Notes follow.
CREATE
Kris,
Thank you for your valuable response, I used the code you list
following:
import java.sql.*;
public class ServerSidePreparedStatement
{
public static void main(String args[]) throws Exception
{
Class.forName("org.postgresql.Driver");
String ur
Dear Postgresql Experts,
A few days ago I posted a message asking about INSERTing a row based on a RECORD
variable in a plpgsql function. I haven't had any replies - maybe it got lost in the
weekend's spam - so I thought I'd post again giving some more background to what I'm
trying to do.
1.
If you do not have foreign key restrinctions, create a temp table from
the select as:
CREATE TEMP TABLE tmp AS SELECT DISTINCT ON (location) location, time,
report FROM weatherReports ORDER BY location, time DESC;
TRUNCATE weatherReports; INSERT INTO weatherReports SELECT * FROM tmp;
HTH
Achill
O kyrios Christoph Haller egrapse stis Jun 16, 2004 :
> Referring to the DISTINCT ON example
>
> SELECT DISTINCT ON (location) location, time, report
> FROM weatherReports
> ORDER BY location, time DESC;
maybe smth like
delete from weatherReports where (location,time,report) not in
(SELECT DI
Referring to the DISTINCT ON example
SELECT DISTINCT ON (location) location, time, report
FROM weatherReports
ORDER BY location, time DESC;
How would I delete those entries skipped by the DISTINCT ON expression?
TIA
Regards, Christoph
---(end of broadcast)
Hello Martin,
There's not much hint to it, here's a solution instead :)
You can make use of several built-in functions to handle strings, date/time values
etc. Take a look at chapter 9: Functions and Operators of your PostgreSQL
documentation all available functions are explained there.
To s