Subject | Re: Performance - Querying newly inserted records for processing - which better? |
---|---|
Author | Eugenio Reis |
Post date | 2004-03-10T14:54:48Z |
> Which is faster to query for newly inserted records for some taskprocessing?
>inserted rows, 'P' for processed rows. Once processed, update this
> METHOD 1 - Use a composite key with a field denoting 'N' for newly
indexed field from 'N' to 'P'.
> METHOD 2 - Use another table to keep the IDs of newly inserted rowsI would stick to method 2. A btree index based on a field of just two
different values (the lowest cardinality) would be the worst case
scenario for such kind of index. You may also consider the possibility
of inserting a timestamp rather than just a N/P flag. This would give
you more flexibility.