News for hackers. Stuff that matters.
Re:How Postgres chooses which index to use for a query by felixge on Friday April 22, 2022 @02:23AM (#31118817)
Agreed. A while ago I looked into hacking something like this into plv8. You'd be able to do something like:

SELECT * FROM js_query('...');

Where the query is a JS snippet that has access to low level access methods, e.g.:

  var results = [];
  var cursor = myTable.indexes.foo.seek('item-23');
  while (cursor.next()) {
    results.push(cursor.row());
  }
  return results;
However, it turns out this would be a lot of work and it's difficult to make it work with features like row level security.

Since I didn't have enough time I dropped the idea, but it'd be awesome if somebody hacked this up at some point : ).

There are no comments on this comment yet.