dremiojs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.eslintrc.json +14 -0
  2. package/.prettierrc +7 -0
  3. package/README.md +59 -0
  4. package/dremiodocs/dremio-cloud/cloud-api-reference.md +748 -0
  5. package/dremiodocs/dremio-cloud/dremio-cloud-about.md +225 -0
  6. package/dremiodocs/dremio-cloud/dremio-cloud-admin.md +3754 -0
  7. package/dremiodocs/dremio-cloud/dremio-cloud-bring-data.md +6098 -0
  8. package/dremiodocs/dremio-cloud/dremio-cloud-changelog.md +32 -0
  9. package/dremiodocs/dremio-cloud/dremio-cloud-developer.md +1147 -0
  10. package/dremiodocs/dremio-cloud/dremio-cloud-explore-analyze.md +2522 -0
  11. package/dremiodocs/dremio-cloud/dremio-cloud-get-started.md +300 -0
  12. package/dremiodocs/dremio-cloud/dremio-cloud-help-support.md +869 -0
  13. package/dremiodocs/dremio-cloud/dremio-cloud-manage-govern.md +800 -0
  14. package/dremiodocs/dremio-cloud/dremio-cloud-overview.md +36 -0
  15. package/dremiodocs/dremio-cloud/dremio-cloud-security.md +1844 -0
  16. package/dremiodocs/dremio-cloud/sql-docs.md +7180 -0
  17. package/dremiodocs/dremio-software/dremio-software-acceleration.md +1575 -0
  18. package/dremiodocs/dremio-software/dremio-software-admin.md +884 -0
  19. package/dremiodocs/dremio-software/dremio-software-client-applications.md +3277 -0
  20. package/dremiodocs/dremio-software/dremio-software-data-products.md +560 -0
  21. package/dremiodocs/dremio-software/dremio-software-data-sources.md +8701 -0
  22. package/dremiodocs/dremio-software/dremio-software-deploy-dremio.md +3446 -0
  23. package/dremiodocs/dremio-software/dremio-software-get-started.md +848 -0
  24. package/dremiodocs/dremio-software/dremio-software-monitoring.md +422 -0
  25. package/dremiodocs/dremio-software/dremio-software-reference.md +677 -0
  26. package/dremiodocs/dremio-software/dremio-software-security.md +2074 -0
  27. package/dremiodocs/dremio-software/dremio-software-v25-api.md +32637 -0
  28. package/dremiodocs/dremio-software/dremio-software-v26-api.md +36757 -0
  29. package/jest.config.js +10 -0
  30. package/package.json +25 -0
  31. package/src/api/catalog.ts +74 -0
  32. package/src/api/jobs.ts +105 -0
  33. package/src/api/reflection.ts +77 -0
  34. package/src/api/source.ts +61 -0
  35. package/src/api/user.ts +32 -0
  36. package/src/client/base.ts +66 -0
  37. package/src/client/cloud.ts +37 -0
  38. package/src/client/software.ts +73 -0
  39. package/src/index.ts +16 -0
  40. package/src/types/catalog.ts +31 -0
  41. package/src/types/config.ts +18 -0
  42. package/src/types/job.ts +18 -0
  43. package/src/types/reflection.ts +29 -0
  44. package/tests/integration_manual.ts +95 -0
  45. package/tsconfig.json +19 -0
@@ -0,0 +1,1575 @@
1
+ # Dremio Software - Acceleration
2
+
3
+
4
+
5
+ ---
6
+
7
+ # Source: https://docs.dremio.com/current/acceleration/
8
+
9
+ Version: current [26.x]
10
+
11
+ On this page
12
+
13
+ # Accelerate Queries
14
+
15
+ In Dremio, queries can be accelerated with Reflections and results cache.
16
+
17
+ ## Reflections
18
+
19
+ A Reflection is a precomputed and optimized copy of source data or a query result, designed to speed up query performance. It is derived from an existing table or view, known as its anchor. Reflections can be:
20
+
21
+ * [Autonomous](/current/acceleration/autonomous-reflections): automatically created and managed by Dremio.
22
+ * [Manual](/current/acceleration/manual-reflections): created and managed by you.
23
+
24
+ Dremio's query optimizer uses Reflections to accelerate queries by avoiding the need to scan the original data. Instead of querying the raw source, Dremio automatically rewrites queries to use Reflections when they provide the necessary results, without requiring you to reference them directly.
25
+
26
+ ![](/images/cloud/query-selection.png)
27
+
28
+ When Dremio receives a query, it determines first whether any Reflections have at least one table in common with the tables and views that the query references. If any Reflections do, Dremio evaluates them to determine whether they satisfy the query. Then, if any Reflections do satisfy the query, Dremio generates a query plan that uses them.
29
+
30
+ Dremio then compares the cost of the plan to the cost of executing the query directly against the tables, and selects the plan with the lower cost. Finally, Dremio executes the selected query plan. Typically, plans that use one or more Reflections are less expensive than plans that run against raw data.
31
+
32
+ ### Types
33
+
34
+ There are different types of Reflections tailored to specific workloads:
35
+
36
+ * **Raw Reflections**: retain the same number of records as its anchor while allowing a subset of columns. It enhances query performance by materializing complex views, transforming data from non-performant sources into the Iceberg table format optimized for large-scale analytics, and utilizing partitioning and sorting for faster access. By precomputing and storing data in an optimized format, raw Reflections significantly reduce query latency and improve overall efficiency.
37
+ * **Aggregation Reflections**: accelerate BI-style queries that involve aggregations (GROUP BY queries) by precomputing results (like `SUM`, `COUNT`, `AVG`, `GROUP BY`) across selected dimensions and measures. By precomputing expensive computations, they significantly improve query performance at runtime. These Reflections are ideal for analytical workloads with frequent aggregations on large datasets.
38
+ * **External Reflections**: reference precomputed tables in external data sources instead of materializing Reflections within Dremio, eliminating refresh overhead and storage costs. You can use an external Reflection by defining a view in Dremio that matches the precomputed table and map the view to the external data source. The data in the precomputed table is not refreshed by Dremio. When querying the view, Dremio’s query planner leverages the external Reflection to generate optimal execution plans, improving query performance without additional storage consumption in Dremio.
39
+ * **Starflake Reflections**: optimize multi-table joins by leveraging precomputed relationships between fact and dimension tables. When joins do not duplicate rows, Dremio can accelerate queries using Reflections even if they include only a subset of the joins in Reflections, reducing the need for multiple Reflections on different combinations of tables.
40
+
41
+ ### Reflections Features and Data Format Compatibility Matrix
42
+
43
+ The following table outlines the availability of key Reflections features across supported data formats, including version-specific enhancements such as Autonomous Reflections, Live Reflections, and Intelligent Incremental Refresh.
44
+
45
+ | Data Format | Autonomous Reflections | Automatic Raw + Aggregation Recommendation | Manual Reflections | Live Reflections (25.1+) | Automatic Raw Recommendation (25.0+) | Intelligent Incremental Refresh (24.3+) |
46
+ | --- | --- | --- | --- | --- | --- | --- |
47
+ | Iceberg | Yes | Yes | Yes | Yes | Yes | Yes |
48
+ | UniForm | Yes | Yes | Yes | Yes | Yes | Yes |
49
+ | Parquet | Yes | Yes | Yes | No | Yes | Yes |
50
+ | Delta | No | No | Yes | No | No | No |
51
+ | Federated Sources | No | No | Yes | No | No | No |
52
+
53
+ ## Results Cache
54
+
55
+ Results cache improves query performance by reusing results from previous executions of the same deterministic query, provided that the underlying dataset remains unchanged and the previous execution was by the same user. The results cache feature works out of the box, requires no configuration, and automatically caches and reuses results. Regardless of whether a query uses results cache, it always returns the same results.
56
+
57
+ Results cache is client-agnostic, meaning a query executed in the Dremio console will result in a cache hit even if it is later re-run through other clients like JDBC, ODBC, REST or Arrow Flight. For a query to use the cache, its query plan must remain identical to the original cached version. Any changes to the schema or dataset generate a new query plan, invalidating the cache.
58
+
59
+ Results cache also supports seamless coordinator scale-out, allowing newly added coordinators to benefit immediately from previously cached results.
60
+
61
+ ### Cases Supported By Results Cache
62
+
63
+ Query result are cached in the following cases:
64
+
65
+ * The SQL statement is a `SELECT` statement.
66
+ * The query reads from an Iceberg, Parquet dataset, or from a raw Reflection defined on other Dremio supported data sources and formats, such as relational databases, `CSV`, `JSON`, or `TEXT`.
67
+ * The query does not contain dynamic functions such as `QUERY_USER`, `IS_MEMBER`, `RAND`, `CURRENT_DATE`, or `NOW`.
68
+ * The query does not reference `SYS` or `INFORMATION_SCHEMA` tables, or use external query.
69
+ * The result set size, when stored in Arrow format, is less than or equal to 20 MB.
70
+ * The query is not executed in Dremio console as a preview.
71
+
72
+ ### Viewing Whether Queries Used Results Cache
73
+
74
+ You can view the list of jobs on the Jobs page to determine if queries from data consumers were accelerated by the results cache.
75
+
76
+ To find whether a query was accelerated by a results cache:
77
+
78
+ 1. Find the job that ran the query and look for the lightning-bolt icon next to it. This icon indicates that the query was accelerated using either Reflections or the results cache.
79
+ 2. Click on the row representing the job that ran the query to view the job summary. The summary, displayed in the pane to the right, provides details on whether the query was accelerated using results cache or Reflections.
80
+
81
+ ![](/images/cloud/jobs-details-results-cache.png)
82
+
83
+ ### Storage
84
+
85
+ Cached results are stored in the distributed storage, configured in dremio.conf. Executors write cache entries as Arrow data files and read them when processing `SELECT` queries that result in a cache hit. Coordinators are responsible for managing the deletion of expired cache files.
86
+
87
+ ### Deletion
88
+
89
+ A background task running on one of the Dremio coordinators handles cache expiration. This task runs every hour to mark cache entries that have not been accessed in the past 24 hours as expired and subsequently deletes them along with their associated cache files.
90
+
91
+ ### Considerations and Limitations
92
+
93
+ SQL queries executed through the Dremio console or a REST client that access the cache will rewrite the cached query results to the job results store to enable pagination. This behavior will be enhanced in future releases.
94
+
95
+ ## Additional Resources
96
+
97
+ Find out more about Reflections by enrolling in the [Data Product Fundamentals course in Dremio University](https://university.dremio.com/course/data-product-fundamentals).
98
+
99
+ Was this page helpful?
100
+
101
+ [Previous
102
+
103
+ DbVisualizer](/current/client-applications/dbvisualizer-legacy)[Next
104
+
105
+ Autonomous Reflections](/current/acceleration/autonomous-reflections)
106
+
107
+ * Reflections
108
+ + Types
109
+ + Reflections Features and Data Format Compatibility Matrix
110
+ * Results Cache
111
+ + Cases Supported By Results Cache
112
+ + Viewing Whether Queries Used Results Cache
113
+ + Storage
114
+ + Deletion
115
+ + Considerations and Limitations
116
+ * Additional Resources
117
+
118
+ ---
119
+
120
+ # Source: https://docs.dremio.com/current/acceleration/autonomous-reflections
121
+
122
+ Version: current [26.x]
123
+
124
+ On this page
125
+
126
+ # Autonomous Reflections Enterprise
127
+
128
+ Dremio automatically creates and drops [Reflections](/current/acceleration) based on query patterns to optimize performance for queries on Iceberg tables, Parquet tables, and views based on them. These Reflections refresh in real time when Iceberg tables change or when Parquet table metadata is updated, turning Reflection management into an automated process.
129
+
130
+ Autonomous Reflections refresh automatically when source data changes on:
131
+
132
+ * **Iceberg tables**: when the table is modified through Dremio or other engines. Dremio polls tables every 10 seconds.
133
+ * **Parquet datasets**: when metadata is updated in Dremio.
134
+
135
+ ## Enable Autonomous Reflections
136
+
137
+ To enable Autonomous Reflections, follow these steps:
138
+
139
+ 1. Navigate to **Settings**.
140
+ 2. Go to the **Preferences** tab.
141
+ 3. Toggle the **Autonomous Reflections** switch to enable the feature.
142
+
143
+ Once enabled, Dremio will automatically create and manage Reflections based on query workload analysis from the last seven days.
144
+
145
+ ## Set the Refresh Engine and Routing Rule for Autonomous Reflections
146
+
147
+ Dremio recommends configuring a dedicated refresh engine with at least two nodes to isolate refresh jobs associated with Autonomous Reflections. This isolation ensures that resource-intensive refresh jobs do not impact user workloads, preserving both query performance and refresh efficiency.
148
+
149
+ When you enable Autonomous Reflections in Dremio or Kubernetes deployments, you will be prompted to specify a refresh engine, and Dremio automatically creates routing rules to direct refresh jobs to the selected engine. For other deployments, you must manually create an engine or queue, depending on the deployment type, and define a routing rule `(query_type() = 'Autonomous Reflections')` at the top of the list to ensure refresh jobs for Autonomous Reflections are prioritized.
150
+
151
+ To replace the current refresh engine or queue for Autonomous Reflections, move the existing routing rule `(query_type() = 'Autonomous Reflections')` from the current engine to a new engine and, at the top of the list to set the highest priority. This ensures that refresh jobs are properly redirected to the newly designated engine.
152
+
153
+ If the assigned refresh engine reaches its capacity, Dremio Autonomous Reflections will pause. Users are then notified through the Dremio console, prompting them to scale up the refresh engine if necessary.
154
+
155
+ ## Behavior
156
+
157
+ Dremio creates up to 100 Reflections, with a maximum of 10 per day.
158
+ The actual number of Reflections depends on query patterns, as well as the configuration and utilization of the Dremio engine assigned to execute Reflection refreshes.
159
+
160
+ When Dremio determines that a Reflection has a low score, it is not immediately dropped. Instead:
161
+
162
+ * The Reflection is disabled for 7 days before it is dropped.
163
+ * Admins can then view disabled Reflections through the Autonomous Reflection History Log.
164
+
165
+ For [Aggregation Reflections](/current/acceleration/#types), Dremio creates system-managed views that cannot be modified or referenced by other views. Admin users can drop these views, but doing also deletes the associated Reflection.
166
+
167
+ If you disable the Autonomous Reflections feature, existing Reflections will continue to function normally, but Dremio will not add new Reflections or drop ineffective ones.
168
+
169
+ ## Limits
170
+
171
+ * Autonomous Reflections are only used when fully synchronized with their source data to ensure up-to-date query results.
172
+ * Autonomous Reflections cannot be modified and can only be dropped by Admins. When a Reflection is manually dropped, Dremio will not recreate it for the next 90 days.
173
+
174
+ ## View History Log for Autonomous Reflections
175
+
176
+ To view the history of changes to Autonomous Reflections in the last 30 days, follow these steps:
177
+
178
+ 1. Navigate to **Settings**.
179
+ 2. Select **Reflections** and click **History Log**.
180
+
181
+ Was this page helpful?
182
+
183
+ [Previous
184
+
185
+ Accelerate Queries](/current/acceleration/)[Next
186
+
187
+ Manually Manage Reflections](/current/acceleration/manual-reflections/)
188
+
189
+ * Enable Autonomous Reflections
190
+ * Set the Refresh Engine and Routing Rule for Autonomous Reflections
191
+ * Behavior
192
+ * Limits
193
+ * View History Log for Autonomous Reflections
194
+
195
+ ---
196
+
197
+ # Source: https://docs.dremio.com/current/acceleration/manual-reflections/
198
+
199
+ Version: current [26.x]
200
+
201
+ On this page
202
+
203
+ # Manually Manage Reflections
204
+
205
+ With [Autonomous Reflections](/current/acceleration/autonomous-reflections) reducing the need for manual work, you no longer need to create or manage Reflections. However, when Autonomous Reflections are not enabled or for situations that require manual control, this page provides guidance on getting Reflection recommendations, creating, managing, and testing Reflections in Dremio.
206
+
207
+ When a Reflection is created, Dremio runs a single job with two steps:
208
+
209
+ * The first step writes the query results as a materialization to the distributed acceleration storage by running the `REFRESH REFLECTION` SQL command.
210
+ * The second step registers the materialization table and its metadata with the catalog so that the query optimizer can find the Reflection's definition and structure.
211
+
212
+ The following screenshot shows the `REFRESH REFLECTION` SQL command used to create the Reflection named `Super-duper reflection`:
213
+
214
+ ![Reflection creation job listed on the Jobs page in the Dremio console](/images/sw_reflection_creation_command.png "Reflection creation job listed on the Jobs page")
215
+
216
+ The Reflection creation job is listed as a single job on the Jobs page, as shown in the example below:
217
+
218
+ ![Reflection creation job listed on the Jobs page in the Dremio console](/images/sw_reflection_creation_single_job.png "Reflection creation job listed on the Jobs page")
219
+
220
+ Dremio creates all Reflections as Apache Iceberg tables, and the metadata for the Reflection is generated at the same time.
221
+
222
+ ### Reflection Recommendations
223
+
224
+ When [Autonomous Reflections](/current/acceleration/autonomous-reflections) are not enabled, Dremio automatically provides recommendations to add and remove Reflections based on query patterns to optimize performance for queries on Iceberg tables, Parquet datasets, and views based on them.
225
+ Recommendations to add Reflections are sorted by overall effectiveness, with the most effective recommendations shown on top. Effectiveness relates to metrics such as the estimated number of accelerated jobs, potential increase in query execution speedup, and potential time saved during querying. These are rough estimates based on past data that can give you insight into the potential benefits of each recommendation.
226
+ Reflections created using these recommendations refresh automatically when source data changes on:
227
+
228
+ * Iceberg tables: when the table is modified through Dremio or other engines. Dremio polls tables every 10 seconds.
229
+ * Parquet datasets: when metadata is updated in Dremio.
230
+ To view and apply Reflection recommendations:
231
+
232
+ 1. Navigate to Project Settings
233
+ 2. Select Reflections.
234
+ 3. Click **Reflections Recommendations** to access the list of suggested Reflections.
235
+ 4. To apply a recommendation, click on the plus icon at the end of the corresponding row.
236
+
237
+ Reflections created using usage based recommendations are only used when fully synchronized with their source data to ensure up-to-date query results.
238
+
239
+ #### Manually Requesting Recommendations for Specific Jobs
240
+
241
+ You can generate recommendations for default raw and aggregation Reflections by submitting job IDs to accelerate specific SQL queries using either the `SYS.RECOMMEND_REFLECTIONS` table function or the [Recommendations API](/current/reference/api/reflections/reflection-recommendations). Obtain the job IDs by looking them up on the [Jobs page](/current/admin/monitoring/jobs/).
242
+
243
+ #### Running the SYS.RECOMMEND\_REFLECTIONS Table Function
244
+
245
+ The `SYS.RECOMMEND_REFLECTIONS` table function returns a table of one or more recommendations.
246
+
247
+ Syntax for the `SYS.RECOMMEND_REFLECTIONS` table function
248
+
249
+ ```
250
+ SELECT * FROM TABLE(SYS.RECOMMEND_REFLECTIONS(ARRAY['<jobId>', '<jobId>']))
251
+ ```
252
+
253
+ The `SYS.RECOMMEND_REFLECTIONS` function's argument must be an array literal.
254
+
255
+ #### Parameters
256
+
257
+ The `SYS.RECOMMEND_REFLECTIONS` table function has one parameter: an array that contains the job IDs for the SQL queries that you want to accelerate.
258
+
259
+ You can list up to 100 job IDs in each `SYS.RECOMMEND_REFLECTIONS` query. You must have permission to view every job you list in the query.
260
+
261
+ #### Output
262
+
263
+ The output for `SYS.RECOMMEND_REFLECTIONS` queries is a table that includes the following columns:
264
+
265
+ | Column Name | Data Type | Description |
266
+ | --- | --- | --- |
267
+ | view\_sql | varchar | **If the recommendation is for a default raw Reflection:** The value in this field is `--Default Raw Reflection`. **If the recommendation is for an aggregation Reflection:** An SQL command that creates a view based on the initial SQL query in the referenced job ID. Dremio uses this view to create an aggregation Reflection when you run the SQL command from the `reflection_sql` column. Before running this command, ensure that you have already created an Arctic catalog or folder named `recommended_view`. |
268
+ | reflection\_sql | varchar | **If the recommendation is for a default raw Reflection:** An SQL command for defining the Reflection on an existing view. **If the recommendation is for an aggregation Reflection:** An SQL command that alters and adds an aggregation Reflection to the view that is created when you run the SQL command in the `view_sql` column. Before running this command, ensure that you have run the corresponding command in the `view_sql` column. Dremio automatically consolidates recommendations for aggregation Reflections when possible to create a single recommendation for similar SQL queries, so the output table may not contain an individual row that corresponds to each job ID listed in the `SYS.RECOMMEND_REFLECTIONS` query. |
269
+ | job\_ids | list | The unique identifier of the jobs that ran the queries for which the recommendation is given. |
270
+ | reflection\_score | double | Dremio's score for the recommended Reflection's quality, on a scale of 0 (worst) to 100 (best). The reflection\_score value considers the recommended Reflection's anticipated quality compared to existing Reflections and other recommended Reflections, as well as the likely improvement in query run times if the recommended Reflection is implemented. |
271
+ | average\_improvement\_factor | double | The likely average multiplicative rate of improvement for each query if you implement the recommended Reflection. For example, if the average\_improvement\_factor value is 2.34, implementing the recommended Reflection is likely to speed up each query by 2.34 times, on average. |
272
+ | average\_improvement\_ms | double | The likely average improvement, in milliseconds, for each query if you implement the recommended Reflection. For example, if the average\_improvement\_ms value is 5400, implementing the recommended Reflection is likely to save an average of 5400 milliseconds for each query that uses the Reflection. |
273
+
274
+ #### Example Query and Output
275
+
276
+ To request a recommendation, you must have the job ID for at least one SQL query that you want to accelerate. For example, suppose this is the SQL query:
277
+
278
+ Example SQL Query
279
+
280
+ ```
281
+ SELECT Max("p_size")
282
+ FROM s3.bucket1.tpch.sf10.parquet.part
283
+ JOIN s3.bucket1.tpch.sf10.parquet.lineitem
284
+ ON "p_partkey" = "l_partkey"
285
+ GROUP BY "p_brand"
286
+ ```
287
+
288
+ ##### Obtaining Recommendations
289
+
290
+ 1. Retrieve the job ID for the query.
291
+ 2. Run the `SYS.RECOMMEND_REFLECTIONS` query with the job ID. In the following example, the job ID is `844c0023-6272-8b16-aef3-aea289acadb1`:
292
+
293
+ Example `SYS.RECOMMEND_REFLECTIONS` Query
294
+
295
+ ```
296
+ SELECT * FROM TABLE(SYS.RECOMMEND_REFLECTIONS(ARRAY['844c0023-6272-8b16-aef3-aea289acadb1']))
297
+ ```
298
+
299
+ The result of the query is returned in this table:
300
+
301
+ Example Results
302
+
303
+ | view\_sql | reflection\_sql | job\_ids | reflection\_score | average\_improvement\_factor | average\_improvement\_ms |
304
+ | --- | --- | --- | --- | --- | --- |
305
+ | CREATE VIEW "recommended\_view"."Dataset\_9d74a03b-747a-42a2-a5ca-7f9c6f77b55d" AS SELECT "part"."P\_BRAND" AS "F0[P\_BRAND]", "part"."P\_SIZE" AS "F1[P\_SIZE]", "part"."P\_PARTKEY" AS "extra#0", "part"."P\_NAME" AS "extra#1", "part"."P\_MFGR" AS "extra#2", "part"."P\_TYPE" AS "extra#4", "part"."P\_CONTAINER" AS "extra#6", "part"."P\_RETAILPRICE" AS "extra#7", "part"."P\_COMMENT" AS "extra#8", "lineitem"."L\_ORDERKEY" AS "extra#9", "lineitem"."L\_PARTKEY" AS "extra#10", "lineitem"."L\_SUPPKEY" AS "extra#11", "lineitem"."L\_LINENUMBER" AS "extra#12", "lineitem"."L\_QUANTITY" AS "extra#13", "lineitem"."L\_EXTENDEDPRICE" AS "extra#14", "lineitem"."L\_DISCOUNT" AS "extra#15", "lineitem"."L\_TAX" AS "extra#16", "lineitem"."L\_RETURNFLAG" AS "extra#17", "lineitem"."L\_LINESTATUS" AS "extra#18", "lineitem"."L\_SHIPDATE" AS "extra#19", "lineitem"."L\_COMMITDATE" AS "extra#20", "lineitem"."L\_RECEIPTDATE" AS "extra#21", "lineitem"."L\_SHIPINSTRUCT" AS "extra#22", "lineitem"."L\_SHIPMODE" AS "extra#23", "lineitem"."L\_COMMENT" AS "extra#24" FROM "s3"."bucket1"."tpch"."sf10"."parquet"."lineitem" INNER JOIN "s3"."bucket1"."tpch"."sf10"."parquet"."part" ON "part"."P\_PARTKEY" = "lineitem"."L\_PARTKEY" | ALTER DATASET "recommended\_view"."Dataset\_9d74a03b-747a-42a2-a5ca-7f9c6f77b55d" CREATE AGGREGATE Reflection "agg\_0e07a376-7f8e-4c68-b2ce-6f6e819bebe6" USING DIMENSIONS ("F0[P\_BRAND]") MEASURES ("F1[P\_SIZE]" (MAX)) | "6j6c34cf-9drf-b07a-5ab7-abea69a66d00", "1a3c67c0-aab0-f9fb-97b4-af374b520100", "1a3c67c0-db35-3645-9ef1-2a84e4d0ce00" | 50.00 | 10.00 | 7196 |
306
+
307
+ ##### Using the Recommendation
308
+
309
+ 1. If a recommendation is for an aggregation Reflection:
310
+
311
+ 1. Create an Arctic catalog or folder named `recommended_view`.
312
+ 2. Run the query listed in the `view_sql` column to create a view based on the initial SQL query.
313
+ 2. Run the query listed in the `reflection_sql` column to create the recommended Reflection and wait for the Reflection to finish refreshing.
314
+ 3. When the Reflection refresh is complete, run the SQL query to observe the acceleration due to the added Reflection.
315
+
316
+ #### Limitations
317
+
318
+ The `SYS.RECOMMEND_REFLECTIONS`table function has the following limitations:
319
+
320
+ * The function cannot provide recommendations for jobs with multiple nested queries that contain joins.
321
+ * An SQL query can contain only inner joins. Outer joins that are part of a view definition are also supported. Other types of joins are not supported.
322
+ * An SQL query cannot contain [Window functions](/current/reference/sql/sql-functions/WINDOW).
323
+
324
+ ### Sending Requests to the Recommendations API
325
+
326
+ You can use the [Recommendations API](/current/reference/api/reflections/reflection-recommendations) to submit the job IDs of jobs that ran SQL queries and receive recommendations for Reflections that can accelerate those queries.
327
+
328
+ ## Locations of the Reflections Editor
329
+
330
+ You use the Reflections editor to create, edit, and remove raw and aggregation Reflections.
331
+
332
+ If you know which table or view you want to create a Reflection from, follow either of these steps to open the Reflections editor:
333
+
334
+ * In the space in which the anchor is located, click the gear icon in the Action field for the anchor. In the sidebar of the Dataset Settings window, select Reflections.
335
+ * In the space in which the anchor is located, click the name of the anchor. Then, click Reflections in the bar at the top of the screen.
336
+
337
+ You can also open the Reflections editor from an existing Reflection that is listed in the Reflections page. Follow these steps to open the Reflections editor:
338
+
339
+ 1. Open the Reflections page.
340
+ 2. Click the gear in the sidebar, and then select Reflections in the sidebar of the Settings page.
341
+ 3. Click the name of the Reflection. The Acceleration window is opened. The editor appears in this window.
342
+
343
+ ## Creating Raw Reflections
344
+
345
+ You can use the Reflections editor to create two types of raw Reflection:
346
+
347
+ * A default raw Reflection that includes all of the columns of the anchor, but does not sort or horizontally partition on any columns
348
+ * A raw Reflection that includes all or a subset of the columns of the anchor, and that does one or both of the following things:
349
+
350
+ + Sorts on one or more columns
351
+ + Horizontally partitions the data according to the values in one or more columns
352
+
353
+ note
354
+
355
+ For creating Reflections on views and tables with row-access and column-masking policies, see [Using Reflections on Datasets with Policies](/current/data-products/govern/row-column-policies-udf#using-reflections-on-datasets-with-policies).
356
+
357
+ ### Prerequisites
358
+
359
+ * If you want to accelerate queries on unoptimized data or data in slow storage, create a view that is itself created from a table in a non-columnar format or on slow-scan storage. You can then create your raw Reflection from that view.
360
+ * If you want to accelerate "needle-in-a-haystack" queries, create a view that includes a predicate to include only the rows that you want to scan. You can then create your raw Reflection from that view.
361
+ * If you want to accelerate queries that perform expensive transformations, create a view that performs those transformations. You can then create your raw Reflection from that view.
362
+ * If you want to accelerate queries that perform joins, create a view that performs the joins. You can then create your raw Reflection from that view.
363
+
364
+ ### Creating Default Raw Reflections
365
+
366
+ In the **Basic** view of the Reflections editor, you can create a raw Reflection that includes all of the fields that are in a table or view. Creating a basic raw Reflection ensures that Dremio never runs user queries against the underlying table or view when the raw Reflection is enabled.
367
+
368
+ #### Restrictions of the **Basic** View
369
+
370
+ * You cannot select fields to sort or create horizontal partitions on.
371
+ * The name of the Reflection that you create is restricted to "Raw Reflection".
372
+ * You can create only one raw Reflection. If you want to create multiple raw Reflections at a time, use the **Advanced** view.
373
+
374
+ To create a raw Reflection in the **Basic** view of the Reflections editor:
375
+
376
+ 1. Open the Reflections editor.
377
+
378
+ See Locations of the Reflections Editor to find out where you can open the editor from.
379
+
380
+ 1. Click the toggle switch on the left side of the **Raw Reflections** bar.
381
+
382
+ ![](/images/cloud/reflections-editor-raw-basic-bar-disabled.png)
383
+
384
+ 1. Click **Save**.
385
+
386
+ tip
387
+
388
+ You can also create raw Reflections using [SQL commands](/current/reference/sql/commands/acceleration).
389
+
390
+ For tips on what to do now after your raw Reflection is created and enabled, see What to Do Next.
391
+
392
+ ### Creating Customized Raw Reflections
393
+
394
+ In the **Advanced** view of the Reflections editor, you can create one or more raw Reflections that include all or a selection of the fields that are in the anchor or supported anchor. You can also choose sort fields and fields for partitioning horizontally.
395
+
396
+ Dremio recommends that you follow the best practices listed in [Best Practices for Creating Raw and Aggregation Reflections](/current/help-support/well-architected-framework/performance/) when you create customized raw Reflections.
397
+
398
+ If you make any of the following changes to a raw Reflection when you are using the **Advanced** view, you cannot switch to the **Basic** view:
399
+
400
+ * Deselect one or more fields in the **Display** column. By default, all of the fields are selected.
401
+ * Select one or more fields in the **Sort**, **Partition**, or **Distribute** column.
402
+
403
+ To create a raw Reflection in the **Advanced** view of the Reflections editor:
404
+
405
+ 1. Open the Reflections editor.
406
+
407
+ See Locations of the Reflections Editor to find out where you can open the editor from.
408
+
409
+ 1. If the **Advanced** view is not already displayed, click the **Advanced View** button in the top-right corner of the editor.
410
+ 2. Click the toggle switch in the table labeled **Raw Reflection** to enable the raw Reflection.
411
+
412
+ Queries do not start using the Reflection, however, until after you finished editing the Reflection and click **Save** in a later step.
413
+
414
+ ![](/images/cloud/reflections-editor-raw-advanced-disabled.png)
415
+
416
+ 1. (Optional) Click in the label to rename the Reflection.
417
+
418
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
419
+
420
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
421
+
422
+ note
423
+
424
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
425
+
426
+ * Click in the **Display** column to include fields in or exclude them from your Reflection.
427
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
428
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
429
+
430
+ note
431
+
432
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, recommended partition columns and transforms are selected for you. If you change the selection of columns, then this icon appears at the top of the table: ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon"). You can click it to revert back to the recommended selection of partition columns.
433
+
434
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
435
+
436
+ a. Click the gear icon in the table in which you are defining the Reflection.
437
+
438
+ b. In the field **Reflection execution strategy**, select either of these options:
439
+
440
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
441
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
442
+ 7. Click **Save** when you are finished.
443
+
444
+ ### What to Do Next
445
+
446
+ After you create a raw Reflection that is enabled, test whether the query optimizer is making queries use it. See [Testing Reflections](/current/reflections/manual-reflections/#testing-reflections) for the steps.
447
+
448
+ When you are sure that the Reflection is being used, follow one of these steps:
449
+
450
+ * If the base table is in the Apache Iceberg format or the Delta Lake format: Set the schedule according to which all Reflections on the table are refreshed.
451
+ * For all other base tables: Set the refresh type for all Reflections on the underlying table and set the schedule according to which they are refreshed.
452
+
453
+ See [Refreshing Reflections](/current/acceleration/manual-reflections/refreshing-reflections/).
454
+
455
+ ## Creating Aggregation Reflections
456
+
457
+ Aggregation Reflections are summarized representations of data. Most BI tools generate aggregation and GROUP BY queries. Aggregation Reflections optimize these kinds of query patterns.
458
+
459
+ When you create aggregation Reflections, keep in mind these best practices:
460
+
461
+ * Use dimensions that have relatively low cardinality in a table or view. The higher the cardinality of a dimension, the less benefit an aggregation Reflection has on query performance. Lower cardinality aggregation Reflections require less time to scan.
462
+ * For a single table or view, create one aggregation Reflection for each important subset of dimensions in your queries, rather than one aggregation Reflection that includes all dimensions. Multiple small aggregation Reflections (versus one large one) are good for isolated pockets of query patterns on the same table or view that do not overlap. If your query patterns overlap, use fewer larger aggregation Reflections.
463
+
464
+ There are two cautions that accompany this advice, however:
465
+
466
+ + Be careful of creating aggregation Reflections that have too few dimensions for your queries.
467
+
468
+ If a query uses more dimensions than are included in an aggregation Reflection, the Reflection cannot satisfy the query and the query optimizer does not run the query against it.
469
+ + Be careful of creating more aggregation Reflections than are necessary to satisfy queries against a table or view.
470
+
471
+ The more Reflections you create, the more time the query optimizer requires to plan the execution of queries. Therefore, creating more aggregation Reflections than you need can slow down query performance, even if your aggregation Reflections are low-cardinality.
472
+ * If you want to include a computed measure, first create a view with the computed column to use as a measure, and then create the aggregation Reflection on the view.
473
+
474
+ Dremio recommends that you also follow the best practices listed in [Best Practices for Creating Raw and Aggregation Reflections](/current/help-support/well-architected-framework/performance/) when you create customized aggregation Reflections.
475
+
476
+ ### Creating Default Aggregation Reflections
477
+
478
+ You can use the **Basic** view of the Reflections editor to create one aggregation Reflection that includes fields, from the anchor or supported anchor, that are recommended for use as dimensions or measures. You can add or remove dimensions and measures, too.
479
+
480
+ #### Restrictions
481
+
482
+ * You can create only one aggregation Reflection in the **Basic** view. If you want to create multiple aggregations Reflections at a time, use the **Advanced** view.
483
+ * You cannot select fields for sorting or horizontally partitioning.
484
+ * The name of the Reflection is restricted to "Aggregation Reflection".
485
+
486
+ #### Procedure
487
+
488
+ To create an aggregation Reflection in the **Basic** view of the Reflections editor:
489
+
490
+ 1. Open the Reflections editor.
491
+
492
+ See Locations of the Reflections Editor to find out where you can open the editor from.
493
+
494
+ In the **Aggregations Reflections** section of the editor, click **Generate** to get recommended fields to use as dimensions and measures. This will override any previously selected dimensions and measures. If you wish to proceed, click **Continue** in the confirmation dialog that follows.
495
+
496
+ ![](/images/agg-reflection-generate.png)
497
+
498
+ 2. In the **Aggregation Reflection** section of the editor, modify or accept the recommended fields for dimensions and measures.
499
+ 3. To make the Reflection available to the query optimizer after you create it, click the toggle switch on the left side of the **Aggregation Reflections** bar.
500
+
501
+ ![](/images/cloud/reflections-editor-agg-basic-disabled.png)
502
+
503
+ 4. Click **Save**.
504
+
505
+ tip
506
+
507
+ You can also create aggregation Reflections using [SQL commands](/current/reference/sql/commands/acceleration).
508
+
509
+ For tips on what to do now after your aggregation Reflection is created and enabled, see What to Do Next.
510
+
511
+ ### Creating Customized Aggregation Reflections
512
+
513
+ You can use the **Advanced** view of the Reflections editor to create one or more aggregation Reflections that select which fields in the anchor or supporting anchor to use as dimensions and measures. For each field that you use as a measure, you can use one or more of these SQL functions: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN. You can also choose sort fields and fields for partitioning horizontally.
514
+
515
+ #### Procedure
516
+
517
+ To create an aggregation Reflection in the **Advanced** view of the Reflections editor:
518
+
519
+ 1. Open the Reflections editor.
520
+
521
+ See Locations of the Reflections Editor to find out where you can open the editor from.
522
+
523
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
524
+ 2. Click **Aggregation Reflections**.
525
+
526
+ The Aggregation Reflections section is displayed, and one table for refining the aggregation Reflection that appeared in the **Basic** view is ready.
527
+
528
+ ![](/images/cloud/reflections-editor-advanced-view-agg-Reflections.png)
529
+
530
+ 1. (Optional) Click in the name to rename the Reflection.
531
+
532
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
533
+
534
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
535
+
536
+ note
537
+
538
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
539
+
540
+ * Click in the **Dimensions** column to include or exclude fields to use as dimensions.
541
+ * Click in the Measures field to include or exclude fields to use as measures. You can use one or more of these SQL functions for each measure: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN.
542
+
543
+ The full list of SQL aggregation functions that Dremio supports is not supported in the Reflections editor. If you want to create a Reflection that aggregates data by using the sQL function AVG, CORR, HLL, SUM, VAR\_POP, or VAR\_SAMP, you must create a view that uses the function, and then create a raw Reflection from that view.
544
+
545
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
546
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
547
+
548
+ note
549
+
550
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, recommended partition columns and transforms are selected for you. If you change the selection of columns, then this icon appears at the top of the table: ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon"). You can click it to revert back to the recommended selection of partition columns.
551
+
552
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
553
+
554
+ a. Click the gear icon in the table in which you are defining the Reflection.
555
+
556
+ b. In the field **Reflection execution strategy**, select either of these options:
557
+
558
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
559
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
560
+ 7. Click **Save** when you are finished.
561
+
562
+ ### What to Do Next
563
+
564
+ After you create an aggregation Reflection that is enabled, test whether the query optimizer is making queries use it. See [Testing Reflections](/current/acceleration/manual-reflections/#testing-reflections) for the steps.
565
+
566
+ When you are sure that the Reflection is being used, follow one of these steps:
567
+
568
+ * If the base table is in the Apache Iceberg format or the Delta Lake format: Set the schedule according to which all Reflections on the table are refreshed.
569
+ * For all other base tables: Set the refresh type for all Reflections on the underlying table and set the schedule according to which they are refreshed.
570
+
571
+ See [Refreshing Reflections](/current/acceleration/manual-reflections/refreshing-reflections/).
572
+
573
+ ## Editing Raw Reflections
574
+
575
+ You can edit an existing raw Reflection. You might want to do so if you are iteratively designing and testing a raw Reflection, if the definition of the view that the Reflection was created from was changed, or if the schema of the underlying table was changed.
576
+
577
+ If you created a raw Reflection in the **Basic** view of the Reflections editor, you must use the **Advanced** view to edit it.
578
+
579
+ Dremio runs the job or jobs to recreate the Reflection after you click **Save**.
580
+
581
+ ### Procedure
582
+
583
+ 1. Open the Reflections editor.
584
+
585
+ See Locations of the Reflections Editor to find out where you can open the editor from.
586
+
587
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
588
+ 2. In the **Raw Reflections** section of the **Advanced** view, locate the table that shows the definition of your Reflection.
589
+ 3. (Optional) Click in the label to rename the Reflection.
590
+
591
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
592
+
593
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
594
+
595
+ note
596
+
597
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
598
+
599
+ * Click in the **Display** column to include fields in or exclude them from your Reflection.
600
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
601
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
602
+
603
+ note
604
+
605
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, partition columns and transforms are recommended for you. Hover over the ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon") icon at the top of the table to see the recommendation. Click the icon to accept the recommendation.
606
+
607
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
608
+
609
+ a. Click the gear icon in the table in which you are defining the Reflection.
610
+
611
+ b. In the field **Reflection execution strategy**, select either of these options:
612
+
613
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
614
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
615
+ 7. Click **Save** when you are finished.
616
+
617
+ ## Editing Aggregation Reflections
618
+
619
+ You might want to edit an aggregation Reflection if you are iteratively designing and testing an aggregation Reflection, if the definition of the view that the Reflection was created from was changed, if the schema of the underlying table was changed, or if you want to revise one or more aggregations defined in the Reflection.
620
+
621
+ If you created an aggregation Reflection in the **Basic** view of the Reflections editor, you can edit that Reflection either in the **Basic** view or in the **Advanced** view.
622
+
623
+ Dremio runs the job or jobs to recreate the Reflection after you click **Save**.
624
+
625
+ ### Editing Aggregation Reflections in the **Basic** View of the Reflections Editor
626
+
627
+ 1. Open the Reflections editor.
628
+
629
+ See Locations of the Reflections Editor to find out where you can open the editor from.
630
+
631
+ 1. In the Aggregation Reflection section of the editor, modify or accept the recommendation for dimension fields and measure fields.
632
+ 2. Click **Save**.
633
+
634
+ ### Editing Aggregation Reflections in the **Advanced** View of the Reflections Editor
635
+
636
+ 1. Open the Reflections editor.
637
+
638
+ See Locations of the Reflections Editor to find out where you can open the editor from.
639
+
640
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
641
+ 2. Click **Aggregation Reflections**.
642
+ 3. (Optional) Click in the name to rename the Reflection.
643
+
644
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
645
+
646
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
647
+
648
+ note
649
+
650
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
651
+
652
+ * Click in the **Dimensions** column to include or exclude fields to use as dimensions.
653
+ * Click in the Measures field to include or exclude fields to use as measures. You can use one or more of these SQL functions for each measure: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN.
654
+
655
+ The full list of SQL aggregation functions that Dremio supports is not supported in the Reflections editor. If you want to create a Reflection that aggregates data by using the sQL function AVG, CORR, HLL, SUM, VAR\_POP, or VAR\_SAMP, you must create a view that uses the function, and then create a raw Reflection from that view.
656
+
657
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
658
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
659
+
660
+ note
661
+
662
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, partition columns and transforms are recommended for you. Hover over the ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon") icon at the top of the table to see the recommendation. Click the icon to accept the recommendation.
663
+
664
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
665
+
666
+ a. Click the gear icon in the table in which you are defining the Reflection.
667
+
668
+ b. In the field **Reflection execution strategy**, select either of these options:
669
+
670
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
671
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
672
+ 7. Click **Save** when you are finished.
673
+
674
+ ## Creating External Reflections
675
+
676
+ See [External Reflections](/current/acceleration/#types) for a description of what external Reflections are and their benefits.
677
+
678
+ To create an external Reflection:
679
+
680
+ 1. Follow these steps in the data source:
681
+
682
+ a. Select your source table.
683
+
684
+ b. Create a table that is derived from the source table, such as an aggregation table, if you do not already have one.
685
+ 2. Follow these steps in Dremio:
686
+
687
+ a. [Define a view on the derived table in the data source.](/current/reference/sql/commands/datasets/#creating-views) The definition must match that of the derived table.
688
+
689
+ b. [Define a new external Reflection that maps the view to the derived table.](/current/reference/sql/commands/acceleration/#external-reflections)
690
+
691
+ note
692
+
693
+ The data types and column names in the external Reflection must match those in the view that the external Reflection is mapped to.
694
+
695
+ ### Example
696
+
697
+ Suppose you have a data source named `mySource` that is connected to Dremio. In that data source, there are (among all of your other tables) these two tables:
698
+
699
+ * `sales`, which is a very large table of sales data.
700
+ * `sales_by_region`, which aggregates by region the data that is in `sales`.
701
+ You want to make the data in `sales_by_region` available to data analysts who use Dremio. However, because you already have the `sales_by_region` table created, you do not see the need to create a Dremio table from `sales`, then create a Dremio view that duplicates `sales_by_region`, and finally create a Reflection on the view. You would like instead to make `sales_by_region` available to queries run from Bi tools through Dremio.
702
+
703
+ To do that, you follow these steps:
704
+
705
+ 1. Create a view in Dremio that has the same definition as `sales_by_region`. Notice that the `FROM` clause points to the `sales` table that is in your data source, not to a Dremio table.
706
+
707
+ Example View
708
+
709
+ ```
710
+ CREATE VIEW "myWorkspace"."sales_by_region" AS
711
+ SELECT
712
+ AVG(sales_amount) average_sales,
713
+ SUM(sales_amount) total_sales,
714
+ COUNT(*) sales_count,
715
+ region
716
+ FROM mySource.sales
717
+ GROUP BY region
718
+ ```
719
+
720
+ 2. Create an external Reflection that maps the view above to `sales_by_region` in `mySource`.
721
+
722
+ Example External Reflection
723
+
724
+ ```
725
+ ALTER DATASET "myWorkspace"."sales_by_region"
726
+ CREATE EXTERNAL Reflection "external_sales_by_region"
727
+ USING "mySource"."sales_by_region"
728
+ ```
729
+
730
+ The external Reflection lets Dremio's query planner know that there is a table in `mySource` that matches the Dremio view `myWorkplace.sales_by_region` and that can be used to satisfy queries against the view. When Dremio users query `myWorkspace.sales_by_region`, Dremio routes the query to the data source `mySource`, which runs the query against `mySource.sales_by_region`.
731
+
732
+ ## Editing External Reflections
733
+
734
+ If you have modified the DDL of a derived table in your data source, follow these steps in Dremio to update the corresponding external Reflection:
735
+
736
+ 1. [Replace the view with one that has a definition that matches the definition of the derived table](/current/reference/sql/commands/datasets/#creating-views). When you do so, the external Reflection is dropped.
737
+ 2. [Define a new external Reflection that maps the view to the derived table.](/current/reference/sql/commands/acceleration/#external-reflections)
738
+
739
+ ## Viewing Whether Queries Used Reflections
740
+
741
+ You can view the list of jobs on the Jobs page to find out whether queries were accelerated by Reflections. The Jobs page lists the jobs that ran queries, both queries from your data consumers and queries run within the Dremio user interface.
742
+
743
+ To find whether a query used a Reflection:
744
+
745
+ 1. Find the job that ran the query by looking below the details in each row.
746
+ 2. Look for the indicator that one or more Reflections were used. A lightning-bolt icon appears next to the job to indicate that a query was accelerated.
747
+ 3. View the job summary by clicking the row that represents the job that ran the query. The job summary appears in the pane to the right of the list of jobs.
748
+
749
+ ### Relationship between Reflections and Jobs
750
+
751
+ The relationship between a job and a Reflection can be one of the following types:
752
+
753
+ * CONSIDERED: the Reflection is defined on a dataset that is used in the query but was determined to not cover the query (for example the Reflection did not have a field that is used by the query).
754
+ * MATCHED: a Reflection could have been used to accelerate the query but Dremio determined that it would not provide any benefits or another Reflection was determined to be a better choice.
755
+ * CHOSEN: a Reflection is used to accelerate the query. Note that multiple Reflections can be used to accelerate queries.
756
+
757
+ ## Testing Reflections
758
+
759
+ You can test whether Reflections that you created are used to satisfy a query without actually running the query. This practice can be helpful when the tables are very large and you want to avoid processing large queries unnecessarily.
760
+
761
+ To test whether one or more Reflections are used by a query:
762
+
763
+ 1. In the side navigation bar, click the SQL Runner icon.
764
+ 2. In the SQL editor, type `EXPLAIN PLAN FOR` and then type or paste in your query.
765
+ 3. Click the **Run** button.
766
+ 4. When the query has finished, click the **Run** link found directly above the query results to view the job details. Any Reflections used will be shown on the page.
767
+
768
+ ## Setting the Expiration Policy for Reflections
769
+
770
+ Rather than delete a Reflection manually, you can specify how long you want Dremio to retain the Reflection before deleting it automatically.
771
+
772
+ note
773
+
774
+ Dremio does not allow expiration policies to be set on external Reflections or Reflections that automatically refresh when Iceberg data changes according to the [refresh policy](/current/acceleration/manual-reflections/refreshing-reflections#types-of-refresh-policies).
775
+
776
+ To set the expiration policy for all Reflections derived from tables in a data source:
777
+
778
+ 1. Right-click a data lake or external source.
779
+ 2. Select **Edit Details**.
780
+ 3. In the sidebar of the Edit Source window, click **Reflection Refresh**.
781
+ 4. After making your changes, click **Save**. The changes take effect on the next refresh.
782
+
783
+ To set the expiration policy on Reflections derived from a particular table:
784
+
785
+ note
786
+
787
+ The table must be based on more than one file.
788
+
789
+ 1. Locate a table.
790
+ 2. Click the gear icon to its right.
791
+ 3. In the sidebar of the Dataset Settings window, click **Reflection Refresh**.
792
+ 4. After making your changes, click **Save**. The changes take effect on the next refresh.
793
+
794
+ ## Removing Reflections
795
+
796
+ You can choose to disable or delete Reflections.
797
+
798
+ ### Disabling Reflections
799
+
800
+ Disabled Reflections become unavailable for use by queries and will not be refreshed manually or according to their schedule.
801
+
802
+ note
803
+
804
+ Dremio does not disable external Reflections.
805
+
806
+ To disable a Reflection:
807
+
808
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
809
+ 2. Follow one of these steps:
810
+ * If there is only one raw Reflection for the table or view, in the **Basic** view click the toggle switch in the **Raw Reflections** bar.
811
+ * If there are two or more raw Reflections for the table or view, in the **Advanced** view click the toggle switch for the individual raw Reflection that you want to disable.
812
+ * If there is only one aggregation Reflection for the table or view, in the **Basic** view click the toggle switch in the **Raw Reflections** bar.
813
+ * If there are two or more aggregation Reflections for the table or view, in the **Advanced** view click the toggle switch for the individual aggregation Reflection that you want to disable.
814
+ 3. Click **Save**. The changes take effect immediately.
815
+
816
+ ### Deleting Reflections
817
+
818
+ You can delete Reflections individually, or all of the Reflections on a table or view. When you delete a Reflection, its definition, data, and metadata are entirely deleted.
819
+
820
+ To delete a single raw or aggregation Reflection:
821
+
822
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
823
+ 2. Open the **Advanced** view, if it is not already open.
824
+ 3. If the Reflection is an aggregation Reflection, click **Aggregation Reflections**.
825
+ 4. Click the trash can icon for the Reflection that you want to delete.
826
+ 5. Click **Save**. The deletion takes effect immediately.
827
+
828
+ To delete all raw and aggregation Reflections on a table or view:
829
+
830
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
831
+ 2. Click **Remove All Reflections**.
832
+ 3. Click **Save**.
833
+
834
+ To delete an external Reflection, or to delete a raw or aggregation Reflection without using the Reflections editor, run this SQL command:
835
+
836
+ Delete a Reflection
837
+
838
+ ```
839
+ ALTER DATASET <DATASET_PATH> DROP Reflection <REFLECTION_NAME>
840
+ ```
841
+
842
+ * DATASET\_PATH: The path of the view on which the external Reflection is based.
843
+ * REFLECTION\_NAME: The name of the external Reflection.
844
+
845
+ ## Additional Resources
846
+
847
+ Find out more about Reflections by enrolling in the [Data Reflections Deep Dive course in Dremio University](https://university.dremio.com/course/data-reflections-deep-dive).
848
+
849
+ Was this page helpful?
850
+
851
+ [Previous
852
+
853
+ Autonomous Reflections](/current/acceleration/autonomous-reflections)[Next
854
+
855
+ View Whether Queries Used Reflections](/current/acceleration/manual-reflections/info-about-queries)
856
+
857
+ * Reflection Recommendations
858
+ * Sending Requests to the Recommendations API
859
+ * Locations of the Reflections Editor
860
+ * Creating Raw Reflections
861
+ + Prerequisites
862
+ + Creating Default Raw Reflections
863
+ + Creating Customized Raw Reflections
864
+ + What to Do Next
865
+ * Creating Aggregation Reflections
866
+ + Creating Default Aggregation Reflections
867
+ + Creating Customized Aggregation Reflections
868
+ + What to Do Next
869
+ * Editing Raw Reflections
870
+ + Procedure
871
+ * Editing Aggregation Reflections
872
+ + Editing Aggregation Reflections in the **Basic** View of the Reflections Editor
873
+ + Editing Aggregation Reflections in the **Advanced** View of the Reflections Editor
874
+ * Creating External Reflections
875
+ + Example
876
+ * Editing External Reflections
877
+ * Viewing Whether Queries Used Reflections
878
+ + Relationship between Reflections and Jobs
879
+ * Testing Reflections
880
+ * Setting the Expiration Policy for Reflections
881
+ * Removing Reflections
882
+ + Disabling Reflections
883
+ + Deleting Reflections
884
+ * Additional Resources
885
+
886
+ ---
887
+
888
+ # Source: https://docs.dremio.com/current/acceleration/manual-reflections
889
+
890
+ Version: current [26.x]
891
+
892
+ On this page
893
+
894
+ # Manually Manage Reflections
895
+
896
+ With [Autonomous Reflections](/current/acceleration/autonomous-reflections) reducing the need for manual work, you no longer need to create or manage Reflections. However, when Autonomous Reflections are not enabled or for situations that require manual control, this page provides guidance on getting Reflection recommendations, creating, managing, and testing Reflections in Dremio.
897
+
898
+ When a Reflection is created, Dremio runs a single job with two steps:
899
+
900
+ * The first step writes the query results as a materialization to the distributed acceleration storage by running the `REFRESH REFLECTION` SQL command.
901
+ * The second step registers the materialization table and its metadata with the catalog so that the query optimizer can find the Reflection's definition and structure.
902
+
903
+ The following screenshot shows the `REFRESH REFLECTION` SQL command used to create the Reflection named `Super-duper reflection`:
904
+
905
+ ![Reflection creation job listed on the Jobs page in the Dremio console](/images/sw_reflection_creation_command.png "Reflection creation job listed on the Jobs page")
906
+
907
+ The Reflection creation job is listed as a single job on the Jobs page, as shown in the example below:
908
+
909
+ ![Reflection creation job listed on the Jobs page in the Dremio console](/images/sw_reflection_creation_single_job.png "Reflection creation job listed on the Jobs page")
910
+
911
+ Dremio creates all Reflections as Apache Iceberg tables, and the metadata for the Reflection is generated at the same time.
912
+
913
+ ### Reflection Recommendations
914
+
915
+ When [Autonomous Reflections](/current/acceleration/autonomous-reflections) are not enabled, Dremio automatically provides recommendations to add and remove Reflections based on query patterns to optimize performance for queries on Iceberg tables, Parquet datasets, and views based on them.
916
+ Recommendations to add Reflections are sorted by overall effectiveness, with the most effective recommendations shown on top. Effectiveness relates to metrics such as the estimated number of accelerated jobs, potential increase in query execution speedup, and potential time saved during querying. These are rough estimates based on past data that can give you insight into the potential benefits of each recommendation.
917
+ Reflections created using these recommendations refresh automatically when source data changes on:
918
+
919
+ * Iceberg tables: when the table is modified through Dremio or other engines. Dremio polls tables every 10 seconds.
920
+ * Parquet datasets: when metadata is updated in Dremio.
921
+ To view and apply Reflection recommendations:
922
+
923
+ 1. Navigate to Project Settings
924
+ 2. Select Reflections.
925
+ 3. Click **Reflections Recommendations** to access the list of suggested Reflections.
926
+ 4. To apply a recommendation, click on the plus icon at the end of the corresponding row.
927
+
928
+ Reflections created using usage based recommendations are only used when fully synchronized with their source data to ensure up-to-date query results.
929
+
930
+ #### Manually Requesting Recommendations for Specific Jobs
931
+
932
+ You can generate recommendations for default raw and aggregation Reflections by submitting job IDs to accelerate specific SQL queries using either the `SYS.RECOMMEND_REFLECTIONS` table function or the [Recommendations API](/current/reference/api/reflections/reflection-recommendations). Obtain the job IDs by looking them up on the [Jobs page](/current/admin/monitoring/jobs/).
933
+
934
+ #### Running the SYS.RECOMMEND\_REFLECTIONS Table Function
935
+
936
+ The `SYS.RECOMMEND_REFLECTIONS` table function returns a table of one or more recommendations.
937
+
938
+ Syntax for the `SYS.RECOMMEND_REFLECTIONS` table function
939
+
940
+ ```
941
+ SELECT * FROM TABLE(SYS.RECOMMEND_REFLECTIONS(ARRAY['<jobId>', '<jobId>']))
942
+ ```
943
+
944
+ The `SYS.RECOMMEND_REFLECTIONS` function's argument must be an array literal.
945
+
946
+ #### Parameters
947
+
948
+ The `SYS.RECOMMEND_REFLECTIONS` table function has one parameter: an array that contains the job IDs for the SQL queries that you want to accelerate.
949
+
950
+ You can list up to 100 job IDs in each `SYS.RECOMMEND_REFLECTIONS` query. You must have permission to view every job you list in the query.
951
+
952
+ #### Output
953
+
954
+ The output for `SYS.RECOMMEND_REFLECTIONS` queries is a table that includes the following columns:
955
+
956
+ | Column Name | Data Type | Description |
957
+ | --- | --- | --- |
958
+ | view\_sql | varchar | **If the recommendation is for a default raw Reflection:** The value in this field is `--Default Raw Reflection`. **If the recommendation is for an aggregation Reflection:** An SQL command that creates a view based on the initial SQL query in the referenced job ID. Dremio uses this view to create an aggregation Reflection when you run the SQL command from the `reflection_sql` column. Before running this command, ensure that you have already created an Arctic catalog or folder named `recommended_view`. |
959
+ | reflection\_sql | varchar | **If the recommendation is for a default raw Reflection:** An SQL command for defining the Reflection on an existing view. **If the recommendation is for an aggregation Reflection:** An SQL command that alters and adds an aggregation Reflection to the view that is created when you run the SQL command in the `view_sql` column. Before running this command, ensure that you have run the corresponding command in the `view_sql` column. Dremio automatically consolidates recommendations for aggregation Reflections when possible to create a single recommendation for similar SQL queries, so the output table may not contain an individual row that corresponds to each job ID listed in the `SYS.RECOMMEND_REFLECTIONS` query. |
960
+ | job\_ids | list | The unique identifier of the jobs that ran the queries for which the recommendation is given. |
961
+ | reflection\_score | double | Dremio's score for the recommended Reflection's quality, on a scale of 0 (worst) to 100 (best). The reflection\_score value considers the recommended Reflection's anticipated quality compared to existing Reflections and other recommended Reflections, as well as the likely improvement in query run times if the recommended Reflection is implemented. |
962
+ | average\_improvement\_factor | double | The likely average multiplicative rate of improvement for each query if you implement the recommended Reflection. For example, if the average\_improvement\_factor value is 2.34, implementing the recommended Reflection is likely to speed up each query by 2.34 times, on average. |
963
+ | average\_improvement\_ms | double | The likely average improvement, in milliseconds, for each query if you implement the recommended Reflection. For example, if the average\_improvement\_ms value is 5400, implementing the recommended Reflection is likely to save an average of 5400 milliseconds for each query that uses the Reflection. |
964
+
965
+ #### Example Query and Output
966
+
967
+ To request a recommendation, you must have the job ID for at least one SQL query that you want to accelerate. For example, suppose this is the SQL query:
968
+
969
+ Example SQL Query
970
+
971
+ ```
972
+ SELECT Max("p_size")
973
+ FROM s3.bucket1.tpch.sf10.parquet.part
974
+ JOIN s3.bucket1.tpch.sf10.parquet.lineitem
975
+ ON "p_partkey" = "l_partkey"
976
+ GROUP BY "p_brand"
977
+ ```
978
+
979
+ ##### Obtaining Recommendations
980
+
981
+ 1. Retrieve the job ID for the query.
982
+ 2. Run the `SYS.RECOMMEND_REFLECTIONS` query with the job ID. In the following example, the job ID is `844c0023-6272-8b16-aef3-aea289acadb1`:
983
+
984
+ Example `SYS.RECOMMEND_REFLECTIONS` Query
985
+
986
+ ```
987
+ SELECT * FROM TABLE(SYS.RECOMMEND_REFLECTIONS(ARRAY['844c0023-6272-8b16-aef3-aea289acadb1']))
988
+ ```
989
+
990
+ The result of the query is returned in this table:
991
+
992
+ Example Results
993
+
994
+ | view\_sql | reflection\_sql | job\_ids | reflection\_score | average\_improvement\_factor | average\_improvement\_ms |
995
+ | --- | --- | --- | --- | --- | --- |
996
+ | CREATE VIEW "recommended\_view"."Dataset\_9d74a03b-747a-42a2-a5ca-7f9c6f77b55d" AS SELECT "part"."P\_BRAND" AS "F0[P\_BRAND]", "part"."P\_SIZE" AS "F1[P\_SIZE]", "part"."P\_PARTKEY" AS "extra#0", "part"."P\_NAME" AS "extra#1", "part"."P\_MFGR" AS "extra#2", "part"."P\_TYPE" AS "extra#4", "part"."P\_CONTAINER" AS "extra#6", "part"."P\_RETAILPRICE" AS "extra#7", "part"."P\_COMMENT" AS "extra#8", "lineitem"."L\_ORDERKEY" AS "extra#9", "lineitem"."L\_PARTKEY" AS "extra#10", "lineitem"."L\_SUPPKEY" AS "extra#11", "lineitem"."L\_LINENUMBER" AS "extra#12", "lineitem"."L\_QUANTITY" AS "extra#13", "lineitem"."L\_EXTENDEDPRICE" AS "extra#14", "lineitem"."L\_DISCOUNT" AS "extra#15", "lineitem"."L\_TAX" AS "extra#16", "lineitem"."L\_RETURNFLAG" AS "extra#17", "lineitem"."L\_LINESTATUS" AS "extra#18", "lineitem"."L\_SHIPDATE" AS "extra#19", "lineitem"."L\_COMMITDATE" AS "extra#20", "lineitem"."L\_RECEIPTDATE" AS "extra#21", "lineitem"."L\_SHIPINSTRUCT" AS "extra#22", "lineitem"."L\_SHIPMODE" AS "extra#23", "lineitem"."L\_COMMENT" AS "extra#24" FROM "s3"."bucket1"."tpch"."sf10"."parquet"."lineitem" INNER JOIN "s3"."bucket1"."tpch"."sf10"."parquet"."part" ON "part"."P\_PARTKEY" = "lineitem"."L\_PARTKEY" | ALTER DATASET "recommended\_view"."Dataset\_9d74a03b-747a-42a2-a5ca-7f9c6f77b55d" CREATE AGGREGATE Reflection "agg\_0e07a376-7f8e-4c68-b2ce-6f6e819bebe6" USING DIMENSIONS ("F0[P\_BRAND]") MEASURES ("F1[P\_SIZE]" (MAX)) | "6j6c34cf-9drf-b07a-5ab7-abea69a66d00", "1a3c67c0-aab0-f9fb-97b4-af374b520100", "1a3c67c0-db35-3645-9ef1-2a84e4d0ce00" | 50.00 | 10.00 | 7196 |
997
+
998
+ ##### Using the Recommendation
999
+
1000
+ 1. If a recommendation is for an aggregation Reflection:
1001
+
1002
+ 1. Create an Arctic catalog or folder named `recommended_view`.
1003
+ 2. Run the query listed in the `view_sql` column to create a view based on the initial SQL query.
1004
+ 2. Run the query listed in the `reflection_sql` column to create the recommended Reflection and wait for the Reflection to finish refreshing.
1005
+ 3. When the Reflection refresh is complete, run the SQL query to observe the acceleration due to the added Reflection.
1006
+
1007
+ #### Limitations
1008
+
1009
+ The `SYS.RECOMMEND_REFLECTIONS`table function has the following limitations:
1010
+
1011
+ * The function cannot provide recommendations for jobs with multiple nested queries that contain joins.
1012
+ * An SQL query can contain only inner joins. Outer joins that are part of a view definition are also supported. Other types of joins are not supported.
1013
+ * An SQL query cannot contain [Window functions](/current/reference/sql/sql-functions/WINDOW).
1014
+
1015
+ ### Sending Requests to the Recommendations API
1016
+
1017
+ You can use the [Recommendations API](/current/reference/api/reflections/reflection-recommendations) to submit the job IDs of jobs that ran SQL queries and receive recommendations for Reflections that can accelerate those queries.
1018
+
1019
+ ## Locations of the Reflections Editor
1020
+
1021
+ You use the Reflections editor to create, edit, and remove raw and aggregation Reflections.
1022
+
1023
+ If you know which table or view you want to create a Reflection from, follow either of these steps to open the Reflections editor:
1024
+
1025
+ * In the space in which the anchor is located, click the gear icon in the Action field for the anchor. In the sidebar of the Dataset Settings window, select Reflections.
1026
+ * In the space in which the anchor is located, click the name of the anchor. Then, click Reflections in the bar at the top of the screen.
1027
+
1028
+ You can also open the Reflections editor from an existing Reflection that is listed in the Reflections page. Follow these steps to open the Reflections editor:
1029
+
1030
+ 1. Open the Reflections page.
1031
+ 2. Click the gear in the sidebar, and then select Reflections in the sidebar of the Settings page.
1032
+ 3. Click the name of the Reflection. The Acceleration window is opened. The editor appears in this window.
1033
+
1034
+ ## Creating Raw Reflections
1035
+
1036
+ You can use the Reflections editor to create two types of raw Reflection:
1037
+
1038
+ * A default raw Reflection that includes all of the columns of the anchor, but does not sort or horizontally partition on any columns
1039
+ * A raw Reflection that includes all or a subset of the columns of the anchor, and that does one or both of the following things:
1040
+
1041
+ + Sorts on one or more columns
1042
+ + Horizontally partitions the data according to the values in one or more columns
1043
+
1044
+ note
1045
+
1046
+ For creating Reflections on views and tables with row-access and column-masking policies, see [Using Reflections on Datasets with Policies](/current/data-products/govern/row-column-policies-udf#using-reflections-on-datasets-with-policies).
1047
+
1048
+ ### Prerequisites
1049
+
1050
+ * If you want to accelerate queries on unoptimized data or data in slow storage, create a view that is itself created from a table in a non-columnar format or on slow-scan storage. You can then create your raw Reflection from that view.
1051
+ * If you want to accelerate "needle-in-a-haystack" queries, create a view that includes a predicate to include only the rows that you want to scan. You can then create your raw Reflection from that view.
1052
+ * If you want to accelerate queries that perform expensive transformations, create a view that performs those transformations. You can then create your raw Reflection from that view.
1053
+ * If you want to accelerate queries that perform joins, create a view that performs the joins. You can then create your raw Reflection from that view.
1054
+
1055
+ ### Creating Default Raw Reflections
1056
+
1057
+ In the **Basic** view of the Reflections editor, you can create a raw Reflection that includes all of the fields that are in a table or view. Creating a basic raw Reflection ensures that Dremio never runs user queries against the underlying table or view when the raw Reflection is enabled.
1058
+
1059
+ #### Restrictions of the **Basic** View
1060
+
1061
+ * You cannot select fields to sort or create horizontal partitions on.
1062
+ * The name of the Reflection that you create is restricted to "Raw Reflection".
1063
+ * You can create only one raw Reflection. If you want to create multiple raw Reflections at a time, use the **Advanced** view.
1064
+
1065
+ To create a raw Reflection in the **Basic** view of the Reflections editor:
1066
+
1067
+ 1. Open the Reflections editor.
1068
+
1069
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1070
+
1071
+ 1. Click the toggle switch on the left side of the **Raw Reflections** bar.
1072
+
1073
+ ![](/images/cloud/reflections-editor-raw-basic-bar-disabled.png)
1074
+
1075
+ 1. Click **Save**.
1076
+
1077
+ tip
1078
+
1079
+ You can also create raw Reflections using [SQL commands](/current/reference/sql/commands/acceleration).
1080
+
1081
+ For tips on what to do now after your raw Reflection is created and enabled, see What to Do Next.
1082
+
1083
+ ### Creating Customized Raw Reflections
1084
+
1085
+ In the **Advanced** view of the Reflections editor, you can create one or more raw Reflections that include all or a selection of the fields that are in the anchor or supported anchor. You can also choose sort fields and fields for partitioning horizontally.
1086
+
1087
+ Dremio recommends that you follow the best practices listed in [Best Practices for Creating Raw and Aggregation Reflections](/current/help-support/well-architected-framework/performance/) when you create customized raw Reflections.
1088
+
1089
+ If you make any of the following changes to a raw Reflection when you are using the **Advanced** view, you cannot switch to the **Basic** view:
1090
+
1091
+ * Deselect one or more fields in the **Display** column. By default, all of the fields are selected.
1092
+ * Select one or more fields in the **Sort**, **Partition**, or **Distribute** column.
1093
+
1094
+ To create a raw Reflection in the **Advanced** view of the Reflections editor:
1095
+
1096
+ 1. Open the Reflections editor.
1097
+
1098
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1099
+
1100
+ 1. If the **Advanced** view is not already displayed, click the **Advanced View** button in the top-right corner of the editor.
1101
+ 2. Click the toggle switch in the table labeled **Raw Reflection** to enable the raw Reflection.
1102
+
1103
+ Queries do not start using the Reflection, however, until after you finished editing the Reflection and click **Save** in a later step.
1104
+
1105
+ ![](/images/cloud/reflections-editor-raw-advanced-disabled.png)
1106
+
1107
+ 1. (Optional) Click in the label to rename the Reflection.
1108
+
1109
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
1110
+
1111
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
1112
+
1113
+ note
1114
+
1115
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
1116
+
1117
+ * Click in the **Display** column to include fields in or exclude them from your Reflection.
1118
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
1119
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
1120
+
1121
+ note
1122
+
1123
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, recommended partition columns and transforms are selected for you. If you change the selection of columns, then this icon appears at the top of the table: ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon"). You can click it to revert back to the recommended selection of partition columns.
1124
+
1125
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
1126
+
1127
+ a. Click the gear icon in the table in which you are defining the Reflection.
1128
+
1129
+ b. In the field **Reflection execution strategy**, select either of these options:
1130
+
1131
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
1132
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
1133
+ 7. Click **Save** when you are finished.
1134
+
1135
+ ### What to Do Next
1136
+
1137
+ After you create a raw Reflection that is enabled, test whether the query optimizer is making queries use it. See [Testing Reflections](/current/reflections/manual-reflections/#testing-reflections) for the steps.
1138
+
1139
+ When you are sure that the Reflection is being used, follow one of these steps:
1140
+
1141
+ * If the base table is in the Apache Iceberg format or the Delta Lake format: Set the schedule according to which all Reflections on the table are refreshed.
1142
+ * For all other base tables: Set the refresh type for all Reflections on the underlying table and set the schedule according to which they are refreshed.
1143
+
1144
+ See [Refreshing Reflections](/current/acceleration/manual-reflections/refreshing-reflections/).
1145
+
1146
+ ## Creating Aggregation Reflections
1147
+
1148
+ Aggregation Reflections are summarized representations of data. Most BI tools generate aggregation and GROUP BY queries. Aggregation Reflections optimize these kinds of query patterns.
1149
+
1150
+ When you create aggregation Reflections, keep in mind these best practices:
1151
+
1152
+ * Use dimensions that have relatively low cardinality in a table or view. The higher the cardinality of a dimension, the less benefit an aggregation Reflection has on query performance. Lower cardinality aggregation Reflections require less time to scan.
1153
+ * For a single table or view, create one aggregation Reflection for each important subset of dimensions in your queries, rather than one aggregation Reflection that includes all dimensions. Multiple small aggregation Reflections (versus one large one) are good for isolated pockets of query patterns on the same table or view that do not overlap. If your query patterns overlap, use fewer larger aggregation Reflections.
1154
+
1155
+ There are two cautions that accompany this advice, however:
1156
+
1157
+ + Be careful of creating aggregation Reflections that have too few dimensions for your queries.
1158
+
1159
+ If a query uses more dimensions than are included in an aggregation Reflection, the Reflection cannot satisfy the query and the query optimizer does not run the query against it.
1160
+ + Be careful of creating more aggregation Reflections than are necessary to satisfy queries against a table or view.
1161
+
1162
+ The more Reflections you create, the more time the query optimizer requires to plan the execution of queries. Therefore, creating more aggregation Reflections than you need can slow down query performance, even if your aggregation Reflections are low-cardinality.
1163
+ * If you want to include a computed measure, first create a view with the computed column to use as a measure, and then create the aggregation Reflection on the view.
1164
+
1165
+ Dremio recommends that you also follow the best practices listed in [Best Practices for Creating Raw and Aggregation Reflections](/current/help-support/well-architected-framework/performance/) when you create customized aggregation Reflections.
1166
+
1167
+ ### Creating Default Aggregation Reflections
1168
+
1169
+ You can use the **Basic** view of the Reflections editor to create one aggregation Reflection that includes fields, from the anchor or supported anchor, that are recommended for use as dimensions or measures. You can add or remove dimensions and measures, too.
1170
+
1171
+ #### Restrictions
1172
+
1173
+ * You can create only one aggregation Reflection in the **Basic** view. If you want to create multiple aggregations Reflections at a time, use the **Advanced** view.
1174
+ * You cannot select fields for sorting or horizontally partitioning.
1175
+ * The name of the Reflection is restricted to "Aggregation Reflection".
1176
+
1177
+ #### Procedure
1178
+
1179
+ To create an aggregation Reflection in the **Basic** view of the Reflections editor:
1180
+
1181
+ 1. Open the Reflections editor.
1182
+
1183
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1184
+
1185
+ In the **Aggregations Reflections** section of the editor, click **Generate** to get recommended fields to use as dimensions and measures. This will override any previously selected dimensions and measures. If you wish to proceed, click **Continue** in the confirmation dialog that follows.
1186
+
1187
+ ![](/images/agg-reflection-generate.png)
1188
+
1189
+ 2. In the **Aggregation Reflection** section of the editor, modify or accept the recommended fields for dimensions and measures.
1190
+ 3. To make the Reflection available to the query optimizer after you create it, click the toggle switch on the left side of the **Aggregation Reflections** bar.
1191
+
1192
+ ![](/images/cloud/reflections-editor-agg-basic-disabled.png)
1193
+
1194
+ 4. Click **Save**.
1195
+
1196
+ tip
1197
+
1198
+ You can also create aggregation Reflections using [SQL commands](/current/reference/sql/commands/acceleration).
1199
+
1200
+ For tips on what to do now after your aggregation Reflection is created and enabled, see What to Do Next.
1201
+
1202
+ ### Creating Customized Aggregation Reflections
1203
+
1204
+ You can use the **Advanced** view of the Reflections editor to create one or more aggregation Reflections that select which fields in the anchor or supporting anchor to use as dimensions and measures. For each field that you use as a measure, you can use one or more of these SQL functions: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN. You can also choose sort fields and fields for partitioning horizontally.
1205
+
1206
+ #### Procedure
1207
+
1208
+ To create an aggregation Reflection in the **Advanced** view of the Reflections editor:
1209
+
1210
+ 1. Open the Reflections editor.
1211
+
1212
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1213
+
1214
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
1215
+ 2. Click **Aggregation Reflections**.
1216
+
1217
+ The Aggregation Reflections section is displayed, and one table for refining the aggregation Reflection that appeared in the **Basic** view is ready.
1218
+
1219
+ ![](/images/cloud/reflections-editor-advanced-view-agg-Reflections.png)
1220
+
1221
+ 1. (Optional) Click in the name to rename the Reflection.
1222
+
1223
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
1224
+
1225
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
1226
+
1227
+ note
1228
+
1229
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
1230
+
1231
+ * Click in the **Dimensions** column to include or exclude fields to use as dimensions.
1232
+ * Click in the Measures field to include or exclude fields to use as measures. You can use one or more of these SQL functions for each measure: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN.
1233
+
1234
+ The full list of SQL aggregation functions that Dremio supports is not supported in the Reflections editor. If you want to create a Reflection that aggregates data by using the sQL function AVG, CORR, HLL, SUM, VAR\_POP, or VAR\_SAMP, you must create a view that uses the function, and then create a raw Reflection from that view.
1235
+
1236
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
1237
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
1238
+
1239
+ note
1240
+
1241
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, recommended partition columns and transforms are selected for you. If you change the selection of columns, then this icon appears at the top of the table: ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon"). You can click it to revert back to the recommended selection of partition columns.
1242
+
1243
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
1244
+
1245
+ a. Click the gear icon in the table in which you are defining the Reflection.
1246
+
1247
+ b. In the field **Reflection execution strategy**, select either of these options:
1248
+
1249
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
1250
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
1251
+ 7. Click **Save** when you are finished.
1252
+
1253
+ ### What to Do Next
1254
+
1255
+ After you create an aggregation Reflection that is enabled, test whether the query optimizer is making queries use it. See [Testing Reflections](/current/acceleration/manual-reflections/#testing-reflections) for the steps.
1256
+
1257
+ When you are sure that the Reflection is being used, follow one of these steps:
1258
+
1259
+ * If the base table is in the Apache Iceberg format or the Delta Lake format: Set the schedule according to which all Reflections on the table are refreshed.
1260
+ * For all other base tables: Set the refresh type for all Reflections on the underlying table and set the schedule according to which they are refreshed.
1261
+
1262
+ See [Refreshing Reflections](/current/acceleration/manual-reflections/refreshing-reflections/).
1263
+
1264
+ ## Editing Raw Reflections
1265
+
1266
+ You can edit an existing raw Reflection. You might want to do so if you are iteratively designing and testing a raw Reflection, if the definition of the view that the Reflection was created from was changed, or if the schema of the underlying table was changed.
1267
+
1268
+ If you created a raw Reflection in the **Basic** view of the Reflections editor, you must use the **Advanced** view to edit it.
1269
+
1270
+ Dremio runs the job or jobs to recreate the Reflection after you click **Save**.
1271
+
1272
+ ### Procedure
1273
+
1274
+ 1. Open the Reflections editor.
1275
+
1276
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1277
+
1278
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
1279
+ 2. In the **Raw Reflections** section of the **Advanced** view, locate the table that shows the definition of your Reflection.
1280
+ 3. (Optional) Click in the label to rename the Reflection.
1281
+
1282
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
1283
+
1284
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
1285
+
1286
+ note
1287
+
1288
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
1289
+
1290
+ * Click in the **Display** column to include fields in or exclude them from your Reflection.
1291
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
1292
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
1293
+
1294
+ note
1295
+
1296
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, partition columns and transforms are recommended for you. Hover over the ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon") icon at the top of the table to see the recommendation. Click the icon to accept the recommendation.
1297
+
1298
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
1299
+
1300
+ a. Click the gear icon in the table in which you are defining the Reflection.
1301
+
1302
+ b. In the field **Reflection execution strategy**, select either of these options:
1303
+
1304
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
1305
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
1306
+ 7. Click **Save** when you are finished.
1307
+
1308
+ ## Editing Aggregation Reflections
1309
+
1310
+ You might want to edit an aggregation Reflection if you are iteratively designing and testing an aggregation Reflection, if the definition of the view that the Reflection was created from was changed, if the schema of the underlying table was changed, or if you want to revise one or more aggregations defined in the Reflection.
1311
+
1312
+ If you created an aggregation Reflection in the **Basic** view of the Reflections editor, you can edit that Reflection either in the **Basic** view or in the **Advanced** view.
1313
+
1314
+ Dremio runs the job or jobs to recreate the Reflection after you click **Save**.
1315
+
1316
+ ### Editing Aggregation Reflections in the **Basic** View of the Reflections Editor
1317
+
1318
+ 1. Open the Reflections editor.
1319
+
1320
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1321
+
1322
+ 1. In the Aggregation Reflection section of the editor, modify or accept the recommendation for dimension fields and measure fields.
1323
+ 2. Click **Save**.
1324
+
1325
+ ### Editing Aggregation Reflections in the **Advanced** View of the Reflections Editor
1326
+
1327
+ 1. Open the Reflections editor.
1328
+
1329
+ See Locations of the Reflections Editor to find out where you can open the editor from.
1330
+
1331
+ 1. Click the **Advanced View** button in the top-right corner of the editor.
1332
+ 2. Click **Aggregation Reflections**.
1333
+ 3. (Optional) Click in the name to rename the Reflection.
1334
+
1335
+ The purpose of the name is to help you understand, when you read job reports, which Reflections the query optimizer considered and chose when planning queries.
1336
+
1337
+ 1. In the columns of the table, follow these steps, which you don't have to do in any particular order:
1338
+
1339
+ note
1340
+
1341
+ Ignore the **Distribution** column. Selecting fields in it has no effect on the Reflection.
1342
+
1343
+ * Click in the **Dimensions** column to include or exclude fields to use as dimensions.
1344
+ * Click in the Measures field to include or exclude fields to use as measures. You can use one or more of these SQL functions for each measure: APPROX\_DISTINCT\_COUNT, COUNT, MAX, and MIN.
1345
+
1346
+ The full list of SQL aggregation functions that Dremio supports is not supported in the Reflections editor. If you want to create a Reflection that aggregates data by using the sQL function AVG, CORR, HLL, SUM, VAR\_POP, or VAR\_SAMP, you must create a view that uses the function, and then create a raw Reflection from that view.
1347
+
1348
+ * Click in the **Sort** column to select fields on which to sort the data in the Reflection. For guidance in selecting a field on which to sort, see the section [Sort Reflections on High-Cardinality Fields](/current/help-support/well-architected-framework/performance/#sort-reflections-on-high-cardinality-fields) in Best Practices for Creating Raw and Aggregation Reflections.
1349
+ * Click in the **Partition** column to select fields on which to horizontally partition the rows in the Reflection. For guidance in selecting fields on which to partition, and which partition transforms to apply to those fields, see the section [Horizontally Partition Reflections that Have Many Rows](/current/help-support/well-architected-framework/performance/#horizontally-partition-reflections-that-have-many-rows).
1350
+
1351
+ note
1352
+
1353
+ If the Reflection is based on an Iceberg table, a filesystem source, an AWS Glue source, or a Hive source, and that table is partitioned, partition columns and transforms are recommended for you. Hover over the ![This is the Recommendations icon.](/images/icons/partition-column-recommendation-icon.png "The Recommendations icon") icon at the top of the table to see the recommendation. Click the icon to accept the recommendation.
1354
+
1355
+ 6. (Optional) Optimize the number of files used to store the Reflection. You can optimize for fast refreshes or for fast read performance by queries. Follow these steps:
1356
+
1357
+ a. Click the gear icon in the table in which you are defining the Reflection.
1358
+
1359
+ b. In the field **Reflection execution strategy**, select either of these options:
1360
+
1361
+ * Select **Minimize Time Needed To Refresh** if you need the Reflection to be created as fast as possible. This option can result in the data for the Reflection being stored in many small files. This is the default option.
1362
+ * Select **Minimize Number Of Files** when you want to improve read performance of queries against the Reflection. With this option, there tend to be fewer seeks performed for a given query.
1363
+ 7. Click **Save** when you are finished.
1364
+
1365
+ ## Creating External Reflections
1366
+
1367
+ See [External Reflections](/current/acceleration/#types) for a description of what external Reflections are and their benefits.
1368
+
1369
+ To create an external Reflection:
1370
+
1371
+ 1. Follow these steps in the data source:
1372
+
1373
+ a. Select your source table.
1374
+
1375
+ b. Create a table that is derived from the source table, such as an aggregation table, if you do not already have one.
1376
+ 2. Follow these steps in Dremio:
1377
+
1378
+ a. [Define a view on the derived table in the data source.](/current/reference/sql/commands/datasets/#creating-views) The definition must match that of the derived table.
1379
+
1380
+ b. [Define a new external Reflection that maps the view to the derived table.](/current/reference/sql/commands/acceleration/#external-reflections)
1381
+
1382
+ note
1383
+
1384
+ The data types and column names in the external Reflection must match those in the view that the external Reflection is mapped to.
1385
+
1386
+ ### Example
1387
+
1388
+ Suppose you have a data source named `mySource` that is connected to Dremio. In that data source, there are (among all of your other tables) these two tables:
1389
+
1390
+ * `sales`, which is a very large table of sales data.
1391
+ * `sales_by_region`, which aggregates by region the data that is in `sales`.
1392
+ You want to make the data in `sales_by_region` available to data analysts who use Dremio. However, because you already have the `sales_by_region` table created, you do not see the need to create a Dremio table from `sales`, then create a Dremio view that duplicates `sales_by_region`, and finally create a Reflection on the view. You would like instead to make `sales_by_region` available to queries run from Bi tools through Dremio.
1393
+
1394
+ To do that, you follow these steps:
1395
+
1396
+ 1. Create a view in Dremio that has the same definition as `sales_by_region`. Notice that the `FROM` clause points to the `sales` table that is in your data source, not to a Dremio table.
1397
+
1398
+ Example View
1399
+
1400
+ ```
1401
+ CREATE VIEW "myWorkspace"."sales_by_region" AS
1402
+ SELECT
1403
+ AVG(sales_amount) average_sales,
1404
+ SUM(sales_amount) total_sales,
1405
+ COUNT(*) sales_count,
1406
+ region
1407
+ FROM mySource.sales
1408
+ GROUP BY region
1409
+ ```
1410
+
1411
+ 2. Create an external Reflection that maps the view above to `sales_by_region` in `mySource`.
1412
+
1413
+ Example External Reflection
1414
+
1415
+ ```
1416
+ ALTER DATASET "myWorkspace"."sales_by_region"
1417
+ CREATE EXTERNAL Reflection "external_sales_by_region"
1418
+ USING "mySource"."sales_by_region"
1419
+ ```
1420
+
1421
+ The external Reflection lets Dremio's query planner know that there is a table in `mySource` that matches the Dremio view `myWorkplace.sales_by_region` and that can be used to satisfy queries against the view. When Dremio users query `myWorkspace.sales_by_region`, Dremio routes the query to the data source `mySource`, which runs the query against `mySource.sales_by_region`.
1422
+
1423
+ ## Editing External Reflections
1424
+
1425
+ If you have modified the DDL of a derived table in your data source, follow these steps in Dremio to update the corresponding external Reflection:
1426
+
1427
+ 1. [Replace the view with one that has a definition that matches the definition of the derived table](/current/reference/sql/commands/datasets/#creating-views). When you do so, the external Reflection is dropped.
1428
+ 2. [Define a new external Reflection that maps the view to the derived table.](/current/reference/sql/commands/acceleration/#external-reflections)
1429
+
1430
+ ## Viewing Whether Queries Used Reflections
1431
+
1432
+ You can view the list of jobs on the Jobs page to find out whether queries were accelerated by Reflections. The Jobs page lists the jobs that ran queries, both queries from your data consumers and queries run within the Dremio user interface.
1433
+
1434
+ To find whether a query used a Reflection:
1435
+
1436
+ 1. Find the job that ran the query by looking below the details in each row.
1437
+ 2. Look for the indicator that one or more Reflections were used. A lightning-bolt icon appears next to the job to indicate that a query was accelerated.
1438
+ 3. View the job summary by clicking the row that represents the job that ran the query. The job summary appears in the pane to the right of the list of jobs.
1439
+
1440
+ ### Relationship between Reflections and Jobs
1441
+
1442
+ The relationship between a job and a Reflection can be one of the following types:
1443
+
1444
+ * CONSIDERED: the Reflection is defined on a dataset that is used in the query but was determined to not cover the query (for example the Reflection did not have a field that is used by the query).
1445
+ * MATCHED: a Reflection could have been used to accelerate the query but Dremio determined that it would not provide any benefits or another Reflection was determined to be a better choice.
1446
+ * CHOSEN: a Reflection is used to accelerate the query. Note that multiple Reflections can be used to accelerate queries.
1447
+
1448
+ ## Testing Reflections
1449
+
1450
+ You can test whether Reflections that you created are used to satisfy a query without actually running the query. This practice can be helpful when the tables are very large and you want to avoid processing large queries unnecessarily.
1451
+
1452
+ To test whether one or more Reflections are used by a query:
1453
+
1454
+ 1. In the side navigation bar, click the SQL Runner icon.
1455
+ 2. In the SQL editor, type `EXPLAIN PLAN FOR` and then type or paste in your query.
1456
+ 3. Click the **Run** button.
1457
+ 4. When the query has finished, click the **Run** link found directly above the query results to view the job details. Any Reflections used will be shown on the page.
1458
+
1459
+ ## Setting the Expiration Policy for Reflections
1460
+
1461
+ Rather than delete a Reflection manually, you can specify how long you want Dremio to retain the Reflection before deleting it automatically.
1462
+
1463
+ note
1464
+
1465
+ Dremio does not allow expiration policies to be set on external Reflections or Reflections that automatically refresh when Iceberg data changes according to the [refresh policy](/current/acceleration/manual-reflections/refreshing-reflections#types-of-refresh-policies).
1466
+
1467
+ To set the expiration policy for all Reflections derived from tables in a data source:
1468
+
1469
+ 1. Right-click a data lake or external source.
1470
+ 2. Select **Edit Details**.
1471
+ 3. In the sidebar of the Edit Source window, click **Reflection Refresh**.
1472
+ 4. After making your changes, click **Save**. The changes take effect on the next refresh.
1473
+
1474
+ To set the expiration policy on Reflections derived from a particular table:
1475
+
1476
+ note
1477
+
1478
+ The table must be based on more than one file.
1479
+
1480
+ 1. Locate a table.
1481
+ 2. Click the gear icon to its right.
1482
+ 3. In the sidebar of the Dataset Settings window, click **Reflection Refresh**.
1483
+ 4. After making your changes, click **Save**. The changes take effect on the next refresh.
1484
+
1485
+ ## Removing Reflections
1486
+
1487
+ You can choose to disable or delete Reflections.
1488
+
1489
+ ### Disabling Reflections
1490
+
1491
+ Disabled Reflections become unavailable for use by queries and will not be refreshed manually or according to their schedule.
1492
+
1493
+ note
1494
+
1495
+ Dremio does not disable external Reflections.
1496
+
1497
+ To disable a Reflection:
1498
+
1499
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
1500
+ 2. Follow one of these steps:
1501
+ * If there is only one raw Reflection for the table or view, in the **Basic** view click the toggle switch in the **Raw Reflections** bar.
1502
+ * If there are two or more raw Reflections for the table or view, in the **Advanced** view click the toggle switch for the individual raw Reflection that you want to disable.
1503
+ * If there is only one aggregation Reflection for the table or view, in the **Basic** view click the toggle switch in the **Raw Reflections** bar.
1504
+ * If there are two or more aggregation Reflections for the table or view, in the **Advanced** view click the toggle switch for the individual aggregation Reflection that you want to disable.
1505
+ 3. Click **Save**. The changes take effect immediately.
1506
+
1507
+ ### Deleting Reflections
1508
+
1509
+ You can delete Reflections individually, or all of the Reflections on a table or view. When you delete a Reflection, its definition, data, and metadata are entirely deleted.
1510
+
1511
+ To delete a single raw or aggregation Reflection:
1512
+
1513
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
1514
+ 2. Open the **Advanced** view, if it is not already open.
1515
+ 3. If the Reflection is an aggregation Reflection, click **Aggregation Reflections**.
1516
+ 4. Click the trash can icon for the Reflection that you want to delete.
1517
+ 5. Click **Save**. The deletion takes effect immediately.
1518
+
1519
+ To delete all raw and aggregation Reflections on a table or view:
1520
+
1521
+ 1. Open the Reflections editor for the Reflection's anchor or supporting anchor. See [Locations of the Reflections Editor](/current/acceleration/manual-reflections/#locations-of-the-reflections-editor).
1522
+ 2. Click **Remove All Reflections**.
1523
+ 3. Click **Save**.
1524
+
1525
+ To delete an external Reflection, or to delete a raw or aggregation Reflection without using the Reflections editor, run this SQL command:
1526
+
1527
+ Delete a Reflection
1528
+
1529
+ ```
1530
+ ALTER DATASET <DATASET_PATH> DROP Reflection <REFLECTION_NAME>
1531
+ ```
1532
+
1533
+ * DATASET\_PATH: The path of the view on which the external Reflection is based.
1534
+ * REFLECTION\_NAME: The name of the external Reflection.
1535
+
1536
+ ## Additional Resources
1537
+
1538
+ Find out more about Reflections by enrolling in the [Data Reflections Deep Dive course in Dremio University](https://university.dremio.com/course/data-reflections-deep-dive).
1539
+
1540
+ Was this page helpful?
1541
+
1542
+ [Previous
1543
+
1544
+ Autonomous Reflections](/current/acceleration/autonomous-reflections)[Next
1545
+
1546
+ View Whether Queries Used Reflections](/current/acceleration/manual-reflections/info-about-queries)
1547
+
1548
+ * Reflection Recommendations
1549
+ * Sending Requests to the Recommendations API
1550
+ * Locations of the Reflections Editor
1551
+ * Creating Raw Reflections
1552
+ + Prerequisites
1553
+ + Creating Default Raw Reflections
1554
+ + Creating Customized Raw Reflections
1555
+ + What to Do Next
1556
+ * Creating Aggregation Reflections
1557
+ + Creating Default Aggregation Reflections
1558
+ + Creating Customized Aggregation Reflections
1559
+ + What to Do Next
1560
+ * Editing Raw Reflections
1561
+ + Procedure
1562
+ * Editing Aggregation Reflections
1563
+ + Editing Aggregation Reflections in the **Basic** View of the Reflections Editor
1564
+ + Editing Aggregation Reflections in the **Advanced** View of the Reflections Editor
1565
+ * Creating External Reflections
1566
+ + Example
1567
+ * Editing External Reflections
1568
+ * Viewing Whether Queries Used Reflections
1569
+ + Relationship between Reflections and Jobs
1570
+ * Testing Reflections
1571
+ * Setting the Expiration Policy for Reflections
1572
+ * Removing Reflections
1573
+ + Disabling Reflections
1574
+ + Deleting Reflections
1575
+ * Additional Resources