You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql/best-practices-sql-on-demand.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,23 +47,23 @@ If possible, you can prepare files for better performance:
47
47
48
48
## Push wildcards to lower levels in path
49
49
50
-
You can use wildcards in your path to [query multiple files and folders](develop-storage-files-overview.md#query-multiple-files-or-folders). SQL on-demand lists files in your storage account starting from first * using storage API and eliminates files that do not match specified path. Reducing initial list of files can improve performance if there are many files that match specified path up to first wildcard.
50
+
You can use wildcards in your path to [query multiple files and folders](develop-storage-files-overview.md#query-multiple-files-or-folders). SQL on-demand lists files in your storage account starting from first * using storage API and eliminates files that don't match specified path. Reducing initial list of files can improve performance if there are many files that match specified path up to first wildcard.
51
51
52
52
## Use appropriate data types
53
53
54
-
Data types used in your query affects performance. You can get better performance if you:
54
+
The data types you use in your query impact performance. You can get better performance if you:
55
55
56
56
- Use the smallest data size that will accommodate the largest possible value.
57
57
- If maximum character value length is 30 characters, use character data type of length 30.
58
58
- If all character column values are of fixed size, use char or nchar. Otherwise, use varchar or nvarchar.
59
59
- If maximum integer column value is 500, use smallint as it is smallest data type that can accommodate this value. You can find integer data type ranges [here](https://docs.microsoft.com/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql?view=sql-server-ver15).
60
60
- If possible, use varchar and char instead of nvarchar and nchar.
61
-
- Use integer-based data types if possible. Sort, join and group by operations are performed faster on integers than on characters data.
62
-
- If you are using schema inference, [check inferred data type](#check-inferred-data-types).
61
+
- Use integer-based data types if possible. Sort, join, and group by operations are performed faster on integers than on characters data.
62
+
- If you're using schema inference, [check inferred data type](#check-inferred-data-types).
63
63
64
64
## Check inferred data types
65
65
66
-
[Schema inference](query-parquet-files.md#automatic-schema-inference) helps you quickly write queries and explore data without knowing file schema. This comfort comes at expense of inferred data types being larger than they actually are. It happens when there is not enough information in source files to make sure appropriate data type is used. For example, Parquet files do not contain metadata about maximum character column length and SQL on-demand infers it as varchar(8000).
66
+
[Schema inference](query-parquet-files.md#automatic-schema-inference) helps you quickly write queries and explore data without knowing file schema. This comfort comes at the expense of inferred data types being larger than they actually are. It happens when there isn't enough information in source files to make sure appropriate data type is used. For example, Parquet files don't contain metadata about maximum character column length and SQL on-demand infers it as varchar(8000).
67
67
68
68
You can check resulting data types of your query using [sp_describe_first_results_set](https://docs.microsoft.com/sql/relational-databases/system-stored-procedures/sp-describe-first-result-set-transact-sql?view=sql-server-ver15).
69
69
@@ -87,7 +87,7 @@ Here is the result set.
87
87
|0|2|pickup_datetime|datetime2(7)|8|
88
88
|0|3|passenger_count|int|4|
89
89
90
-
Once we know inferred data types for query we can specify appropriate data types:
90
+
Once we know inferred data types for query, we can specify appropriate data types:
91
91
92
92
```sql
93
93
SELECT
@@ -138,4 +138,4 @@ If you need better performance, try SAS credentials to access storage until AAD
138
138
139
139
## Next steps
140
140
141
-
Review the [Troubleshooting](../sql-data-warehouse/sql-data-warehouse-troubleshoot.md?toc=/azure/synapse-analytics/toc.json&bc=/azure/synapse-analytics/breadcrumb/toc.json) article for common issues and solutions. If you're working with SQL pool rather than SQL on-demand, please see the [Best Practices for SQL pool](best-practices-sql-pool.md) article for specific guidance.
141
+
Review the [Troubleshooting](../sql-data-warehouse/sql-data-warehouse-troubleshoot.md?toc=/azure/synapse-analytics/toc.json&bc=/azure/synapse-analytics/breadcrumb/toc.json) article for common issues and solutions. If you're working with SQL pool rather than SQL on-demand, see the [Best Practices for SQL pool](best-practices-sql-pool.md) article for specific guidance.
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql/create-use-external-tables.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,11 @@ The queries in this article will be executed on your sample database and use the
56
56
57
57
## Create an external table on protected data
58
58
59
-
You can create external tables that access data on an Azure storage account that allows access to users with some Azure AD identity or SAS key. You can create external tables the same way you create regular SQL Server external tables. The query below creates an external table that reads *population.csv* file from SynapseSQL demo Azure storage account that is referenced using `sqlondemanddemo` data source and protected with database scoped credential called `sqlondemand`. Data source and database scoped credential are created in [setup script](https://github.com/Azure-Samples/Synapse/blob/master/SQL/Samples/LdwSample/SampleDB.sql).
59
+
You can create external tables that access data on an Azure storage account that allows access to users with some Azure AD identity or SAS key. You can create external tables the same way you create regular SQL Server external tables.
60
+
61
+
The following query creates an external table that reads *population.csv* file from SynapseSQL demo Azure storage account that is referenced using `sqlondemanddemo` data source and protected with database scoped credential called `sqlondemand`.
62
+
63
+
Data source and database scoped credential are created in [setup script](https://github.com/Azure-Samples/Synapse/blob/master/SQL/Samples/LdwSample/SampleDB.sql).
60
64
61
65
> [!NOTE]
62
66
> Change the first linein the query, i.e., [mydbname], so you're using the database you created.
@@ -99,7 +103,7 @@ CREATE EXTERNAL TABLE Taxi (
99
103
FILE_FORMAT = ParquetFormat
100
104
);
101
105
```
102
-
## Use a external table
106
+
## Use an external table
103
107
104
108
You can use [external tables](develop-tables-external-tables.md) in your queries the same way you use them in SQL Server queries.
0 commit comments