external query VS user function - Mailing list pgsql-general

From Joao Ferreira gmail
Subject external query VS user function
Date
Msg-id 1221125938.6676.9.camel@jmf-ubuntu
Whole thread Raw
Responses Re: external query VS user function
Re: external query VS user function
Re: external query VS user function
List pgsql-general
Hello all,

I'm trying to optimize the execution of a query which deletes a big
amount of records based on time

I need to remove from 100.000 to 1.000.000 records from my table once a
day, and I'dd like to make that removal as fast as possible. This is the
idea:

DELETE FROM tt WHERE time < $1;


Would it be considerably faster if I declare that query inside a user
function, let's say function_delete(integer), and invoque it instead

SELECT function_delete($max_time);


Would this second approach be faster ? I imagine there could be some
internal mechanism that would allow pg to have that query pre-optimized
somehow ?

thanks for the feedback.

Joao

[[[ I've been looking at Partitioning, but it seems to be a quite
intrusive setup if you already have your system up and running]]]



pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: xml queries & date format
Next
From: Jef Peeraer
Date:
Subject: Re: xml queries & date format