productivity tools: new 5.0 features, n1ql queries, and more – connect silicon valley 2017

23
Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. DEVELOPER FEATURES What’s New in Couchbase 5.0 1

Upload: couchbase

Post on 21-Jan-2018

57 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

DEVELOPER FEATURESWhat’s New in Couchbase 5.0

1

Page 2: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 2

Eben Haber

Senior Software Engineer & User Advocate

LinkedIn – https://www.linkedin.com/in/ebenhaber

Your Presenter

2

Page 3: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

OBJECTIVES1

2

3

4

5

Query Workbench Enhancements

Query Monitoring

Couchbase Import/Export Tools

Couchbase Web Console

Demo

3

Page 4: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

1QUERY WORKBENCH ENHANCEMENTS

4

Page 5: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 5

Query Plans in the Query Workbench

• Plans help explain query performance

• New “Explain” button – get the query plan without

adding “explain” keyword

• Workbench also automatically runs “Explain” with

every query. Plans stored in the Query History, so

you can re-examine plans from prior queries

• Workbench queries also set ‘collect timings’

parameter, plan result shows time spent in each

operator

• Even better, now supports visual query plans

Page 6: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 6

Visual Query Plan

6

Page 7: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 7

Visual Query Plan (Explain)

7

Textual query plans are lengthy and hard to read. Version 5.0 now supports Visual query plans.

Shows the query execution plan in easy to understand visual flow diagrams and additionally provide other useful information.

Each visual query plan displays

• summary of buckets, fields, indexes used in query

• visual tree of query operators,

After query execution, can show:

• time spent per operator

• cost of each operator as a percentage of the total cost of the plan

• number of items processed (input & output)

• highlighted expensive operators

Page 8: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 8

Schema Inferencing/INFER

• No fixed schemas in Couchbase

• Document structure can evolve as the developer sees fit

• Yet documents usually share common structure(s)

• INFER command (added in 4.5) randomly samples documents from a bucket,

produces schema(s) (compatable with http://json-schema.org)

• Based on a random sample, schemas are a “guess”, may miss rare elements

• In 5.0:

• Workbench automatically infers schemas for each bucket in background

• Schemas come up more quickly in Bucket Insights Panel

• Field/Index names available for auto-completion when writing queries

• Workbench also shows document counts for each bucket

Page 9: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 9

Schema Inferencing and Query Checking

• Couchbase has no fixed schema, can’t normally detect typos/non-existent fields

• Instead of a syntax error, you get unexpected result

• Release 5.0 has partial solution:

• Workbench automatically does schema inferencing (INFER) on each bucket.

• Inferred schema, combined with query plan, can identify some misspelled/incorrect field names

• False positives for very rare fields, not found by INFER

• False negatives for nested queries and expressions (e.g., ARRAY) not processed in query plan

Page 10: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 10

Query History maintains a history of all

the queries executed on the Query

Workbench

• scroll through the history window or

use arrow keys at the top of the

editor to navigate

• search the query history by entering

a text in the search box located on

the top

• delete the currently selected query

from the history

• delete all the entire query history

Enhanced Query History

Page 11: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 11

Query Preferences

Query Preferences provides you with ability to

change the run-time settings for Query Service

through Run-Time Preferences window

- Collect query timings

- Max Parallelism

- Scan Consistency

- Positional Parameters

- Named Parameters

- (or regular query HTTP params, if “$” omitted)

- Query Timeout (default 5 min)

Page 12: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 12

Query Import/Export

Query Import/Export provides you with tools to

• Load the saved query from a file into the Query

Editor

• Export the query statement in the .txt format

• Export the query results in the JSON format

12

Page 13: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

2QUERY MONITORING

13

Page 14: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 14

Query Monitoring

14

Since 4.5, Couchbase provided node-specific query information: e.g., system:active_requests

In 5.0, global query information, i.e. details of queries that are “active” (currently running), “completed” (recently run), or “prepared” (aggregate statistics for prepared queries) and ability to cancel/kill long-running queries.

Query Monitoring UI displays

• Active Queries – all running queries are displayed, with details such as the query text, the node IP address, duration, request identification number, and the current state of the query. Additionally, provide ability to cancel a long running query.

• Completed Queries – all completed queries that took longer than 1 second, with details as above plus result count and timestamp.

• Prepared Queries - aggregate statistics for prepared queries, e.g., query syntax, average elapsed time, and number of invokations.

Page 15: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 15

Query Monitoring

15

Page 16: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

3COUCHBASE IMPORT/EXPORT TOOLS

16

Page 17: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 17

CBImport

17

‘cbimport' is a new tool to import data into a Couchbase cluster from different data sources. In 5.0,

cbimport supports importing data from CSV file or JSON documents.

• Each supported format is a sub-command of the cbimport tool

• ‘cbimport csv’: Imports data into Couchbase from a CSV file

• ‘cbimport json’: Imports data into Couchbase from a JSON file

• ‘cbimport' tool also supports custom key-generation for each document in the imported file. Key

generation is done with a combination of pre-existing fields in a document and custom generator

functions supplied by cbimport.

• ‘cbimport' tool supports importing JSON document of different structure

• JSON object on each line,

• files that contain a JSON list (that is array) where each element is a document,

• and the Couchbase Samples files

Page 18: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 18

CBExport

18

‘cbexport' is a new tool to export data from a Couchbase cluster. In 5.0, cbexport supports

exporting JSON data to a file.

• Each supported format is a sub-command of the cbexport tool

• cbexport json: Exports JSON data from Couchbase to a file

• cbexport tool supports exporting JSON document of different structure

• JSON object on each line,

• files that contain a JSON list (that is array) where each element is a document,

• Couchbase Samples files

Page 19: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

4COUCHBASE WEB CONSOLE

19

Page 20: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 20

Couchbase Web Console

20

Goals of the redefined Couchbase Web Console -

• To maximize the usability of the existing features

• Revise sitemap, visual design, and navigation

• Increase UI power & flexibility.

• Update frameworks; optimize UI design

• Responsive design - make better use of screen real estate

• Expand the feature set.

• Incorporate new Spock features; better utilize current REST calls for monitoring, notification, etc

Page 21: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 21

Couchbase Web Console

21

Page 22: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

5 DEMO !!!

22

Page 23: Productivity tools: new 5.0 features, N1QL queries, and more  – Connect Silicon Valley 2017

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.

THANK YOU!

23