Re: external query VS user function

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Joao Ferreira gmail" <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: external query VS user function
Date: 2008-09-11 10:19:01
Message-ID: 162867790809110319v6cfbe6al3756752378cff656@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2008/9/11 Joao Ferreira gmail <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>:
> 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);
>
>

using function hasn't any positive effect there. Evaluation is same,

regards
Pavel Stehule

> 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]]]
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-09-11 10:23:57 Re: xml queries & date format
Previous Message Jef Peeraer 2008-09-11 09:46:27 Re: xml queries & date format