Re: Indexing question - Mailing list pgsql-performance

From Christopher Kings-Lynne
Subject Re: Indexing question
Date
Msg-id 0be001c36e05$83034fb0$2800a8c0@mars
Whole thread Raw
In response to Indexing question  ("Alexander Priem" <ap@cict.nl>)
List pgsql-performance
> So if I understand correctly I could ditch the 'deleted' field entirely
and
> use just the 'deleteddate' field. This 'deleteddate' field would be NULL
by
> default. It would contain a date value if the record is considered
> 'deleted'.
>
> The index would be 'create index a on tablename(deleteddate) where
> deleteddate is null'.
>
> I could then access 'current' records with a view like 'create view x_view
> as select * from tablename where deleteddate is null'.
>
> Is that correct? This would be the best performing solution for this kind
of
> thing, I think (theoretically at least)?

Yes, I think it would be best.  Definitely better than your current
solution.

Cheers,

Chris


pgsql-performance by date:

Previous
From: Ken Geis
Date:
Subject: Re: bad estimates
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: bad estimates