Couchbase Console 6.6.3-N1QL | select * is displaying few extra fields that are not required

select * is displaying a few extra fields that are not required. This happens only for certain meta().id’s and not for all.

However, we need only the information that’s part of results array .

Can someone assist on this?

Thanks
Ajay

Example

{
    "requestID": "321640e3-332d-475d-8877-913b6e6e83a0",
    "clientContextID": "2bf5d993-c0cc-48d2-a419-c2b36818ec55",
    "signature": {
        "*": "*"
    },
    **"results": [**
**      content........**
**    ],**
    "status": "success",
    "metrics": {
        "elapsedTime": "3.467506ms",
        "executionTime": "3.42304ms",
        "resultCount": 1,
        "resultSize": 8392
    },
    "profile": {
        "phaseTimes": {
	    "authorize": "739.118µs",
	    "fetch": "328.734µs",
	    "filter": "40.555µs",
	    "indexScan": "884.774µs",
	    "instantiate": "23.248µs",
	    "parse": "597.337µs",
	    "plan": "382.712µs",
	    "run": "2.406039ms"
	},
        "phaseCounts": {
	    "fetch": 1,
	    "filter": 1,
	    "indexScan": 1
	},
        "phaseOperators": {
	    "authorize": 1,
	    "fetch": 1,
	    "filter": 1,
	    "indexScan": 1
	},
        "executionTimings": {
	    "#operator": "Sequence",
	    "#stats": {
	        "#phaseSwitches": 1,
	        "execTime": "1.418µs"
	    },
	    "~children": [
	        {
	            "#operator": "Authorize",
	            "#stats": {
	                "#phaseSwitches": 3,
	                "execTime": "3.856µs",
	                "servTime": "735.262µs"
	            },
	            "privileges": {
	                "List": [
	                    {
	                        "Target": "default:cb_scrsu_dcshelper_int_gc_io_1",
	                        "Priv": 7
	                    }
	                ]
	            },
	            "~child": {
	                "#operator": "Sequence",
	                "#stats": {
	                    "#phaseSwitches": 1,
	                    "execTime": "2.715µs"
	                },
	                "~children": [
	                    {
	                        "#operator": "IndexScan3",
	                        "#stats": {
	                            "#itemsOut": 1,
	                            "#phaseSwitches": 7,
	                            "execTime": "16.518µs",
	                            "kernTime": "1.277µs",
	                            "servTime": "868.256µs"
	                        },
	                        "index": "dcs_metaid",
	                        "index_id": "ec7098c12ee521f9",
	                        "index_projection": {
	                            "primary_key": true
	                        },
	                        "keyspace": "cb_scrsu_dcshelper_int_gc_io_1",
	                        "namespace": "default",
	                        "spans": [
	                            {
	                                "exact": true,
	                                "range": [
	                                    {
	                                        "high": "\"SR::FS::SU2587878879\"",
	                                        "inclusion": 1,
	                                        "low": "\"SR::FS::SU2587878878\""
	                                    }
	                                ]
	                            }
	                        ],
	                        "using": "gsi"
	                    },
	                    {
	                        "#operator": "Fetch",
	                        "#stats": {
	                            "#itemsIn": 1,
	                            "#itemsOut": 1,
	                            "#phaseSwitches": 9,
	                            "execTime": "15.22µs",
	                            "kernTime": "900.23µs",
	                            "servTime": "313.514µs"
	                        },
	                        "keyspace": "cb_scrsu_dcshelper_int_gc_io_1",
	                        "namespace": "default"
	                    },
	                    {
	                        "#operator": "Sequence",
	                        "#stats": {
	                            "#phaseSwitches": 1,
	                            "execTime": "2.32µs"
	                        },
	                        "~children": [
	                            {
	                                "#operator": "Filter",
	                                "#stats": {
	                                    "#itemsIn": 1,
	                                    "#itemsOut": 1,
	                                    "#phaseSwitches": 7,
	                                    "execTime": "40.555µs",
	                                    "kernTime": "1.236929ms"
	                                },
	                                "condition": "((meta(`cb_scrsu_dcshelper_int_gc_io_1`).`id`) like \"SR::FS::SU2587878878%\")"
	                            },
	                            {
	                                "#operator": "InitialProject",
	                                "#stats": {
	                                    "#itemsIn": 1,
	                                    "#itemsOut": 1,
	                                    "#phaseSwitches": 8,
	                                    "execTime": "5.386µs",
	                                    "kernTime": "1.282337ms"
	                                },
	                                "result_terms": [
	                                    {
	                                        "expr": "self",
	                                        "star": true
	                                    }
	                                ]
	                            },
	                            {
	                                "#operator": "FinalProject",
	                                "#stats": {
	                                    "#itemsIn": 1,
	                                    "#itemsOut": 1,
	                                    "#phaseSwitches": 4,
	                                    "execTime": "2.232µs",
	                                    "kernTime": "23.716µs"
	                                }
	                            }
	                        ]
	                    }
	                ]
	            }
	        },
	        {
	            "#operator": "Stream",
	            "#stats": {
	                "#itemsIn": 1,
	                "#itemsOut": 1,
	                "#phaseSwitches": 5,
	                "execTime": "313.299µs",
	                "kernTime": "2.0668ms"
	            }
	        }
	    ],
	    "~versions": [
	        "6.6.3-N1QL",
	        "6.6.3-9808-enterprise"
	    ]
	}
    }
}

Query - select * from bucketName where meta().id like “id%”

You can turn off the metrics section by turning off the metrics request flag, the signature similarly with the signature flag. e.g. in cbq:

\set -metrics false;
\set -signature false;

Or via cURL:

curl http://localhost:8093/query/service -H "Content-Type: application/json" -u Administrator:pword -d '{"metrics":false,"signature":false,"statement":"select 1"}'

The profile section is only included if you’ve turned profiling on -

this you can turn off with the profile setting, e.g.

curl -u Administrator:pword  http://127.0.0.1:8093/admin/settings  -H 'Content-Type: application/json' -d '{"profile": "off"}'

<edit>
To set it at the request level, similarly to metrics & signature, pass appropriate query parameter. e.g.

\set -profile "off";

or

curl http://localhost:8093/query/service -H "Content-Type: application/json" -u Administrator:pword -d '{"profile":"off","metrics":false,"signature":false,"statement":"select 1"}'

</edit>

But for more than this, I’d suggest you process the JSON output with a tool of your choice (e.g. jq) to extract just the field you’re interested in - but bear in mind, if you looks solely for “results” you will miss any errors.

HTH.

Thanks for your response. But I have a question. I don’t see the metrics information for other id’s in the same bucket (for select *) why do I see this only for some specific id (meta().id)?

Also, can you share a sample to turn off the metrics via the CB console? We are an application team and we won’t be having access to run the curl command.

How are you submitting your queries? – Which SDK or tool are you using?

Are you seeing the profile section for all records and only the metrics section for some? Or vice versa?

If it is the profile section that is only showing up for certain records, is it consistent for which meta().ids it is appearing for? (i.e. is it possible an administrator is turning on/off profiling periodically and you’re just seeing the inconsistent effects?)

In the console UI (Query Workbench), the metrics information isn’t presented in the results so you shouldn’t have a need to turn metrics off there. But what settings are available are under the gear icon found in the upper right.

Setting the profile as a query server setting should be done by an administrator - so someone who does have cURL access to the server. For this you perhaps should ask your administrators to verify that the profile is off and stays off if it is causing application problems. (You should really however still accept JSON output and interpret it before presentation, meaning additional fields could be ignored.)

Turn off profile (Table 4) at Cluster level or request level (UI or SDKs) Settings and Parameters | Couchbase Docs . The link will have how to run off other fields.
Cluster level profile must be off (only on for rare case/short period during debug)