Re: Dynamic Partial Index

From: gustavo halperin <ggh(dot)develop(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic Partial Index
Date: 2006-08-17 21:19:16
Message-ID: 44E4DD54.4010106@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis wrote:
> On Thu, 2006-08-17 at 20:50 +0300, gustavo halperin wrote:
>
>> I'm interesting in a partial index for a rows that aren't older than 6
>> mounts, something like the sentence below:
>> --------------------------------------------------------------------------------------------------------------------------------------------------
>> /CREATE INDEX name_for_the_index ON table (the_column_of_type_date)
>>
>> WHERE ( the_column_of_type_date > (current_date - interval '6
>> month')::date );/
>> --------------------------------------------------------------------------------------------------------------------------------------------------
>> But this is not posible, I receive the next error:
>> --------------------------------------------------------------------------------------------------------------------------------------------------
>> ERROR: functions in index predicate must be marked IMMUTABLE
>> --------------------------------------------------------------------------------------------------------------------------------------------------
>> So, what is the best solution for my problem?
>>
>
> Create an index on the table, and then periodically move records into a
> separate archive table.
>
> Regards,
> Jeff Dave
Thanks, but I have a question. If the table is a BIIIIIIG table, use
your solution is still a good idea ?? What about to create a partial
INDEX for the really current date (and not using the function
current_date) and periodically dropped and created it with the current
day again and again ??

Thank you again,
Gustavo

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Walter Vaughan 2006-08-17 22:01:33 Re: Newbie "Copy From" not working
Previous Message Dawid Kuroczko 2006-08-17 21:14:09 Re: Best approach for a "gap-less" sequence