aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistget.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-09-19 23:32:27 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-09-19 23:32:59 -0400
commitd3a4f89d8a3e500bd7c0b7a8a8a5ce1b47859128 (patch)
tree70fb69ae101513a3b225629ef3c6b75f838c2896 /src/backend/access/gist/gistget.c
parent896537f078ba4d709ce754ecaff8350fd55bdfd8 (diff)
downloadpostgresql-d3a4f89d8a3e500bd7c0b7a8a8a5ce1b47859128.tar.gz
postgresql-d3a4f89d8a3e500bd7c0b7a8a8a5ce1b47859128.zip
Allow no-op GiST support functions to be omitted.
There are common use-cases in which the compress and/or decompress functions can be omitted, with the result being that we make no data transformation when storing or retrieving index values. Previously, you had to provide a no-op function anyway, but this patch allows such opclass support functions to be omitted. Furthermore, if the compress function is omitted, then the core code knows that the stored representation is the same as the original data. This means we can allow index-only scans without requiring a fetch function to be provided either. Previously you had to provide a no-op fetch function if you wanted IOS to work. This reportedly provides a small performance benefit in such cases, but IMO the real reason for doing it is just to reduce the amount of useless boilerplate code that has to be written for GiST opclasses. Andrey Borodin, reviewed by Dmitriy Sarafannikov Discussion: https://postgr.es/m/CAJEAwVELVx9gYscpE=Be6iJxvdW5unZ_LkcAaVNSeOwvdwtD=A@mail.gmail.com
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r--src/backend/access/gist/gistget.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 760ea0c997e..06dac0bb53d 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -801,11 +801,13 @@ gistgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
* Can we do index-only scans on the given index column?
*
* Opclasses that implement a fetch function support index-only scans.
+ * Opclasses without compression functions also support index-only scans.
*/
bool
gistcanreturn(Relation index, int attno)
{
- if (OidIsValid(index_getprocid(index, attno, GIST_FETCH_PROC)))
+ if (OidIsValid(index_getprocid(index, attno, GIST_FETCH_PROC)) ||
+ !OidIsValid(index_getprocid(index, attno, GIST_COMPRESS_PROC)))
return true;
else
return false;