Skip to content

YSQL Tutorial: Indexes

jguerreroyb edited this page Nov 8, 2019 · 4 revisions

In this tutorial you’ll learn how to use YugaByte DB’s PostgreSQL-compatible YSQL interface to query data and create database objects using the Northwind sample database. For detailed information concerning specific clauses or operators, please refer to the official PostgreSQL documentation.

To start, make sure you have all the necessary prerequisites and have logged into the YSQL shell.fetch

Note: These instructions last tested with YugaByte DB 2.0

Let's begin!

CREATE INDEX

CREATE an INDEX on a table

In this exercise we'll create an index on the ORDERS table using the employee_id table.


CREATE INDEX "order_table_index" ON orders USING btree (employee_id);

DROP INDEX

DROP an INDEX on a table

In this exercise we'll drop an index on the ORDERS table.


DROP INDEX "order_table_index";