Is there a “the item before this item in the BTREE index” operator?
up vote
0
down vote
favorite
I need to update a record matching a secondary key where a certain timestamp field is the highest value under a certain other value. I have a composite BTREE index that covers the two relevant columns.
Is there an equivalent of Java's TreeMap.floorKey() to retrieve the corresponding value in a PostgreSQL index?
I tried Googling for a solution and found only convoluted work-arounds for what should be a very simple and specific operation.
postgresql
add a comment |
up vote
0
down vote
favorite
I need to update a record matching a secondary key where a certain timestamp field is the highest value under a certain other value. I have a composite BTREE index that covers the two relevant columns.
Is there an equivalent of Java's TreeMap.floorKey() to retrieve the corresponding value in a PostgreSQL index?
I tried Googling for a solution and found only convoluted work-arounds for what should be a very simple and specific operation.
postgresql
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to update a record matching a secondary key where a certain timestamp field is the highest value under a certain other value. I have a composite BTREE index that covers the two relevant columns.
Is there an equivalent of Java's TreeMap.floorKey() to retrieve the corresponding value in a PostgreSQL index?
I tried Googling for a solution and found only convoluted work-arounds for what should be a very simple and specific operation.
postgresql
I need to update a record matching a secondary key where a certain timestamp field is the highest value under a certain other value. I have a composite BTREE index that covers the two relevant columns.
Is there an equivalent of Java's TreeMap.floorKey() to retrieve the corresponding value in a PostgreSQL index?
I tried Googling for a solution and found only convoluted work-arounds for what should be a very simple and specific operation.
postgresql
postgresql
asked Nov 10 at 21:50
Alex R
4,03294796
4,03294796
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10
add a comment |
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243754%2fis-there-a-the-item-before-this-item-in-the-btree-index-operator%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe a combination of ORDER BY, LIMIT, and OFFSET. Otherwise post more details.
– eurotrash
Nov 10 at 22:10