Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-34994

Inline function with args: Running an equivalent parameterized subquery is much faster

    XMLWordPrintable

Details

    • Untriaged
    • No

    Description

      Build : 6.5.0-3633

      On a 1-node cluster having kv+index+query services, with beer-sample bucket installed, run the following queries.

      create function getnames(typevar, lim) language inline as (select raw name from `beer-sample` where `type`=typevar limit lim)

      select * from `beer-sample` where name in (getnames("beer",1)) --> returns in 4m5s

      Now run its equivalent query with subquery:
      select * from `beer-sample` a where a.name in (select raw (b.`name`) from `beer-sample` b where ((b.`type`) = $typevar) limit $lim) -> returns in 860ms

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            marco.greco Marco Greco (Inactive)
            mihir.kamdar Mihir Kamdar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty