Re: [SQL] Is there a faster way to do this?

2004-06-16 Thread Greg Sabino Mullane
-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

Re: [SQL] [JDBC] Prepare Statement

2004-06-16 Thread Jie Liang
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

[SQL] Inheritance, plpgsql inserting, and revisions

2004-06-16 Thread Phil Endecott
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.

Re: [SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Jean-Luc Lachance
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

Re: [SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Achilleus Mantzios
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

[SQL] How to delete the not DISTINCT ON entries

2004-06-16 Thread Christoph Haller
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)

Re: [SQL] Your question in postgresql.org forum (Diff. between two times as a numeric value in a stored proc)

2004-06-16 Thread Stijn Vanroye
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