From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | gustavo halperin <ggh(dot)develop(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Dynamic Partial Index |
Date: | 2006-08-18 00:35:11 |
Message-ID: | 1155861311.26280.19.camel@dogma.v10.wvs |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2006-08-18 at 00:19 +0300, gustavo halperin wrote:
> > 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 ??
>
If you continue to drop and recreate an index like that, it will need to
scan the table during the creation of the index. That will take a while
on a large table.
You might be better off just using a normal index. To search the index
only takes log(n) time. What problem are you currently having with a
normal index?
The downside of a normal index on a large table is that the index will
grow large and consume space. I think the solution is to move seldom-
accessed records to a separate archive table. That way, you don't ever
have to scan the archive table unless you do a search in the archives.
Regards,
Jeff Davis
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-08-18 00:40:38 | Re: select * from users where user_id NOT in (select |
Previous Message | Chris | 2006-08-18 00:34:44 | Re: count and limit |