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
@@ -21,6 +22,7 @@ This package is currently in a pre-release beta, please use with caution and ope
21
22
-[Unique Keys](#unique-keys)
22
23
-[Series Timestamps](#series-timestamps)
23
24
-[Computed Columns](#computed-columns)
25
+
-[Increment Columns without Primary Key](#increment-columns-without-primary-key)
24
26
-[Testing](#testing)
25
27
-[License](#license)
26
28
-[Resources](#resources)
@@ -85,7 +87,7 @@ In case you want to store failed jobs in SingleStore, then make sure you also se
85
87
86
88
If you are encountering issues connecting to the SingleStore Managed Service, it may be due to your environment not being able to verify the SSL certificate used to secure connections. You can fix this by downloading and manually specifying the SingleStore certificate file.
87
89
88
-
*[Download the file here](https://portal.singlestore.com/static/ca/singlestore_bundle.pem)
90
+
*[Download the file here][singlestore-pem]
89
91
* In the Laravel SingleStore connection configuration, point the variable `PDO::MYSQL_ATTR_SSL_CA` at `singlestore_bundle.pem`:
90
92
91
93
```php
@@ -105,18 +107,30 @@ get a string like `"5423"` in PHP.
The best method to solve this is to upgrade to PHP 8.1 or higher. If that's not possible, [Eloquent's attribute casting](https://laravel.com/docs/9.x/eloquent-mutators#attribute-casting) is the next best solution.
113
+
The best method to solve this is to upgrade to PHP 8.1 or higher. If that's not possible, [Eloquent's attribute casting] is the next best solution.
112
114
113
115
## Migrations
114
116
115
-
This driver provides many SingleStore specific methods for creating or modifying tables. They are listed below. For more information see the [Create Table](https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-definition-language-ddl/create-table.html) docs on SingleStore.
117
+
This driver provides many SingleStore specific methods for creating or modifying tables. They are listed below. For more information see the [create table] docs on SingleStore.
118
+
119
+
### Universal Storage Tables (Columnstore)
120
+
121
+
By default, tables created by this driver will use [SingleStoreDB Universal Storage][columnstore]. Universal Storage leverages both column and row oriented data structures to automatically optimize storage for transactional and analytical workloads. In general, you should use this table type for all tables unless you profile your workload and determine that another table type is better.
122
+
123
+
To create a table, you can simply use `Schema::create`:
124
+
125
+
```php
126
+
Schema::create('table', function (Blueprint $table) {
127
+
// ... column definitions, indexes, table options
128
+
});
129
+
```
116
130
117
131
### Rowstore Tables
118
132
119
-
To create a rowstore table, use the `rowstore` method.
133
+
To create a [rowstore] table, use the `rowstore` method. Rowstore tables are optimized for low-latency transactional workloads with high concurrency at the expense of memory. In general, we recommend using Universal Storage (see above) and benchmarking your workload before using a rowstore table.
120
134
121
135
```php
122
136
Schema::create('table', function (Blueprint $table) {
@@ -128,7 +142,7 @@ Schema::create('table', function (Blueprint $table) {
128
142
129
143
### Reference Tables
130
144
131
-
To create a reference table, you may use the `reference` method.
145
+
To create a [reference table], you may use the `reference` method. Reference tables are fully replicated to every node in the cluster. This means that if you store 1000 rows in a reference table, those 1000 rows will be copied many times. Because of this you should only store small amounts of data in reference tables, and only when you need to reference that data via joins against non-collocated data in other tables. Inserts and updates to reference tables will also run slower due to the high replication overhead.
132
146
133
147
```php
134
148
Schema::create('table', function (Blueprint $table) {
@@ -140,7 +154,7 @@ Schema::create('table', function (Blueprint $table) {
140
154
141
155
### Global Temporary Tables
142
156
143
-
To create a [global temporary table](https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-definition-language-ddl/create-table.html), you may use the `global` method on the table.
157
+
To create a [global temporary table], you may use the `global` method on the table.
144
158
145
159
```php
146
160
Schema::create('table', function (Blueprint $table) {
You can mark particular columns as [sparse](https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-definition-language-ddl/create-table.html) fluently by appending `sparse` to the column's definition.
181
+
You can mark particular columns as [sparse] fluently by appending `sparse` to the column's definition. This only applies to Rowstore tables.
168
182
169
183
```php
170
184
Schema::create('table', function (Blueprint $table) {
@@ -176,7 +190,7 @@ Schema::create('table', function (Blueprint $table) {
176
190
177
191
### Sparse Tables
178
192
179
-
You can mark particular entire tables as [sparse](https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-definition-language-ddl/create-table.html) fluently by appending `sparse` to the column's definition.
193
+
You can mark particular entire tables as [sparse] fluently by appending `sparse` to the column's definition. This only applies to Rowstore tables.
180
194
181
195
```php
182
196
Schema::create('table', function (Blueprint $table) {
@@ -190,7 +204,7 @@ Schema::create('table', function (Blueprint $table) {
190
204
191
205
### Shard Keys
192
206
193
-
You can add a [shard key](https://docs.singlestore.com/managed-service/en/developer-resources/porting-tables-to-singlestoredb-cloud/shard-keys.html) to your tables using the standalone `shardKey` method, or fluently by appending `shardKey` to the column definition.
207
+
You can add a [shard key] to your tables using the standalone `shardKey` method, or fluently by appending `shardKey` to the column definition.
194
208
195
209
```php
196
210
Schema::create('table', function (Blueprint $table) {
@@ -213,7 +227,7 @@ Schema::create('table', function (Blueprint $table) {
213
227
214
228
### Sort Keys
215
229
216
-
You can add a [sort key](https://docs.singlestore.com/managed-service/en/create-a-database/physical-database-schema-design/procedures-for-physical-database-schema-design/creating-a-columnstore-table.html) to your tables using the standalone `sortKey` method, or fluently by appending `sortKey` to the column definition.
230
+
You can add a [sort key] to your tables using the standalone `sortKey` method, or fluently by appending `sortKey` to the column definition.
217
231
218
232
```php
219
233
Schema::create('table', function (Blueprint $table) {
@@ -234,7 +248,7 @@ Schema::create('table', function (Blueprint $table) {
234
248
});
235
249
```
236
250
237
-
Sort keys by default works only for `asc` sort queries. If you would like to create a sort key with `desc` order, you can set the key direction.
251
+
Sort keys sort in ascending order by default. If you would like to create a sort key which sorts descending you can set the key direction to `desc`.
238
252
239
253
```php
240
254
Schema::create('table', function (Blueprint $table) {
@@ -259,6 +273,20 @@ Schema::create('table', function (Blueprint $table) {
259
273
});
260
274
```
261
275
276
+
Sometimes you may want to tune [columnstore][columnstore-tuning] per table. You can do it by appending `with` fluently to the `sortKey` definition.
277
+
278
+
```php
279
+
Schema::create('table', function (Blueprint $table) {
You can add an `unique key` to your tables using the standalone `unique` method, or fluently by appending `unique` to the column definition.
@@ -281,22 +309,6 @@ Schema::create('table', function (Blueprint $table) {
281
309
});
282
310
```
283
311
284
-
### Sort Keys - Columnstore variables
285
-
286
-
Sometimes you may want to customize your [columstore variables](https://docs.singlestore.com/managed-service/en/create-a-database/physical-database-schema-design/procedures-for-physical-database-schema-design/configuring-the-columnstore-to-work-effectively.html) individually per table. You can do it by appending `with` fluently to the `sortKey` definition.
287
-
288
-
```php
289
-
Schema::create('table', function (Blueprint $table) {
To denote a column as a series timestamp, use the `seriesTimestamp` column modifier.
302
314
@@ -311,7 +323,7 @@ Schema::create('table', function (Blueprint $table) {
311
323
312
324
### Computed Columns
313
325
314
-
SingleStore does not support virtual computed columns. You must use Laravel's [`storedAs`](https://laravel.com/docs/9.x/migrations#column-modifiers) method to create a [persisted computed column](https://docs.singlestore.com/managed-service/en/create-a-database/physical-database-schema-design/procedures-for-physical-database-schema-design/using-persistent-computed-columns.html).
326
+
SingleStore does not support virtual computed columns. You must use Laravel's [`storedAs`] method to create a [persisted computed column].
315
327
316
328
```php
317
329
Schema::create('test', function (Blueprint $table) {
@@ -323,8 +335,7 @@ Schema::create('test', function (Blueprint $table) {
323
335
324
336
### Increment Columns without Primary Key
325
337
326
-
Sometimes you may want to set a custom primary key. However if your table has an int `increment` column,
327
-
Laravel, by default, always sets this column as the primary key. Even if you manually set another one. This behavior can be disabled using the `withoutPrimaryKey` method.
338
+
Sometimes you may want to set a custom primary key. However if your table has an int `increment` column, Laravel, by default, always sets this column as the primary key. Even if you manually set another one. This behavior can be disabled using the `withoutPrimaryKey` method.
328
339
329
340
```php
330
341
Schema::create('test', function (Blueprint $table) {
@@ -379,3 +390,17 @@ RESPECT TO THIS BETA SOFTWARE CONNECTOR (INCLUDING TOOLS AND UTILITIES).
379
390
APPLICABLE OPEN SOURCE LICENSE: Apache 2.0
380
391
381
392
IF YOU OR YOUR COMPANY DO NOT AGREE TO THESE TERMS AND CONDITIONS, DO NOT CHECK THE ACCEPTANCE BOX, AND DO NOT DOWNLOAD, ACCESS, COPY, INSTALL OR USE THE SOFTWARE OR THE SERVICES.
0 commit comments