Siddharood
Siddharood

Reputation: 988

Big query Query Statistics

How to get query Statistics such as Time Taken to execute and other parameters in Bigquery using C#.

            QueryRequest _r = new QueryRequest();
            _r.Query = "SELECT Id, Name FROM [Sample.Test] LIMIT 1000";
            QueryResponse _qr = _service.Jobs.Query(_r, "samplequery").Fetch();

            List<string> _fieldNames = _qr.Schema.Fields.ToList().Select(x => x.Name).ToList() ;

            List<Google.Apis.Bigquery.v2.Data.TableRow> _rows = _qr.Rows.ToList();

There is JobStatistics Class, but i am not getting job statistics from above query execution. Else If there is any other way to get statistics pls suggest.

Thanks

Upvotes: 1

Views: 552

Answers (1)

Siddharood
Siddharood

Reputation: 988

I got it.

            Job _j = _service.Jobs.Get(_qr.JobReference.ProjectId, _qr.JobReference.JobId).Fetch();

            JobStatistics _js = _j.Statistics;

            this.StartTime =  _js.StartTime;
            this.EndTime = _js.EndTime;
            this.BytesProcessed = _js.TotalBytesProcessed;

Upvotes: 4

Related Questions