Skip to content

Commit f84a32a

Browse files
committed
Added NonClusteredIndexDirection docs
1 parent 4c86da3 commit f84a32a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ columnOpts.Store.Add(StandardColumn.LogEvent);
110110
columnOpts.LogEvent.DataLength = 2048;
111111
columnOpts.PrimaryKey = columnOpts.TimeStamp;
112112
columnOpts.TimeStamp.NonClusteredIndex = true;
113+
columnOpts.TimeStamp.NonClusteredIndexDirection = SqlIndexDirection.Desc;
113114

114115
var log = new LoggerConfiguration()
115116
.WriteTo.MSSqlServer(
@@ -349,6 +350,7 @@ Each Standard Column in the `ColumnOptions.Store` list and any custom columns yo
349350
* `AllowNull`
350351
* `DataLength`
351352
* `NonClusteredIndex`
353+
* `NonClusteredIndexDirection`
352354

353355
### ColumnName
354356

@@ -412,9 +414,20 @@ Supported SQL column data types that use this property:
412414

413415
Any individual column can be defined as a non-clustered index, including the table primary key. Use this with caution, indexing carries a relatively high write-throughput penalty. One way to mitigate this is to keep non-clustered indexes offline and use batch reindexing on a scheduled basis.
414416

417+
### NonClusteredIndexDirection
418+
419+
Specifies the sort direction (`ASC` or `DESC`) for a non-clustered index on the SQL column.
420+
The default value is `ASC`.
421+
422+
It is especially useful for the timestamp column,
423+
where choosing the correct sort direction can optimize query performance for workloads that typically scan
424+
recent data first.
425+
426+
This only has effect if `NonClusteredIndex` is `true`.
427+
415428
## Standard Columns
416429

417-
By default (and consistent with the SQL DDL to create a table shown earlier) these columns are included in a new `ColumnOptions.Store` list:
430+
By default (and consistent with the SQL DDL to create a table shown earlier), these columns are included in a new `ColumnOptions.Store` list:
418431

419432
- `StandardColumn.Id`
420433
- `StandardColumn.Message`

0 commit comments

Comments
 (0)