When a query is run How are the results displayed?
By default, Limit 100 is set to limit the results to 100 rows. You can turn off this option to return a larger result set. If you turn off this option, you can include the LIMIT option in your SQL statement if you want to avoid very large result sets. For more information, see ORDER BY clause in the Amazon Redshift Database Developer Guide. Show
To display a query plan in the results area, turn on Explain. Turn on Explain graph for the results to also display a graphical representation of the explain plan. To save a query to the Queries folder, choose Save. For a successful query, a success message appears. If the query returns information, the results display in the Results section. If the number of results exceeds the display area, numbers appear at the top of the results area. You can choose the numbers to display successive pages of results. You can filter and sort Result for each column. To enter filter criteria in the result column header, hover over the column to see a menu ( ) where you can enter criteria to filter the column.If the query contains an error, the query editor v2 displays an error message in the results area. The message provides information on how to correct the query. You can export or copy the results of your query by using the context (right-click) menu in the results area as follows:
You can also use the shortcut Ctrl+C on Windows or Cmd+C on MacOS to copy data from the current results page to the clipboard. If no rows are selected, then the cell with focus is copied to the clipboard. If rows are selected, then the selected rows are copied to the clipboard. To add a new query tab, choose the icon, then Editor, which appears in the row with the query tabs. The query tab is either using anIsolated session or not. With an isolated session, the results of a SQL command, such as creating a temporary table in one editor tab, are not visible in another editor tab. When you open an editor tab in query editor v2, the default is an isolated session.To run a query
To display the explain plan for a query
The query editor v2 supports the following features:
The SQL editor supports the following features:
For a demo of editor features, watch the following video. Query examplesFollowing, you can find descriptions of the various types of queries that you can run. The data used in many of these queries is from the 1 sample schema. For more information about the 1 data, see Loading sample data.When you run these example queries, confirm that you choose the correct database in the editor, such as 3.Example: Setting session variablesThe following command sets the 4 server configuration parameter to public for the session. For more information, see SET and search_path in the Amazon Redshift Database Developer Guide.
Example: Top event by total salesThe following query finds the event with the most sales.
Following is a partial list of the results.
Example: Sales greater than a specific parameterThe following query finds sales where the quantity sold is greater than the parameter specified by 5. When the parameter value is 6, the result is 60 rows. When you run the query, the query editor v2 displays a Run query form window to gather the value of parameters in the SQL statement.
Following is a partial list of the results.
Example: Create a temporary tableThe following statement creates the temporary table eventsalestemp by selecting information from the sales and event tables.
Example: Selecting from a temporary tableThe following statement selects events, total orders, and total sales from the temporary table eventsalestemp, ordered by total orders.
Following is a partial list of results.
Considerations for queryingConsider the following information about working with queries when you use the query editor:
|