Commit Graph

14 Commits

Author SHA1 Message Date
Mazdak Farrokhzad d6bc325244 Define TableName and ReducerName backed by EcoString (#4137)
# Description of Changes

The first commit defines a type `TableName` that is used in e.g.,
`TxData` and where determined profitable and necessary to do this
change.
`TableName` is backed by
[`ecow::EcoString`](https://docs.rs/ecow/0.2.6/ecow/string/struct.EcoString.html)
which affords O(1) clones and 15 bytes of inline storage and
`mem::size_of::<EcoString>() == 16`.

The second commit does the same for `ReducerName`. This is also used in
reducer execution.

Together, these commits increase TPS by around 5-7k TPS.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Covered by existing tests.
2026-01-27 23:20:30 +00:00
joshua-spacetime f7ef92b078 fix plan caching for client-specific views (#3672)
# Description of Changes

Fixes a subscription plan caching bug related to client-specific views.

Before this fix, you could define a client-specific view:
```rust
fn my_view(ctx: &ViewContext) -> Option<Player> {
    ctx.db.player().identity().find(ctx.sender)
}
```

And subscribe to it as follows:
```sql
SELECT * FROM my_view
```

Note this view is implicitly parameterized by `:sender`, however when
generating a query hash for this subscription, this fact would not be
taken into account which would result in this query being cached and
reused for all callers.

After this fix, a query hash is generated for this subscription as
though it were given as:
```sql
SELECT * FROM my_view WHERE identity = :sender
```

# API and ABI breaking changes

None

**Note for CLI code owners:**

I had to touch the `subscribe` cli command file. No updates to the api.
It just needed to be updated to look for views in the module def.

# Expected complexity level and risk

1

# Testing

- [x] Added a regression smoketest
2025-11-19 00:33:40 +00:00
joshua-spacetime f5d3bcd1be Add view handling to query engine and planner (#3578)
# Description of Changes

This patch does the following:

1. Expands views as part of query planning. Views are always assumed to
be materialized by the query planner, however a view's backing table may
have private columns such as the `sender` column. The query planner
needs to filter by this column in order to select the rows pertaining to
a particular caller.
2. Plumbs `AuthCtx` through the query optimizer. This is needed in order
to implement (1).
3. Adds a new operator for views to the query engine that drops a view's
private columns

# API and ABI breaking changes

None

# Expected complexity level and risk

2.5

# Testing

- [x] SQL http tests
- [ ] Subscription tests
- [ ] One off query tests
2025-11-05 19:19:26 +00:00
joshua-spacetime ec30c0b048 Add rls to the subscription api (#2546) 2025-04-04 21:12:39 +00:00
joshua-spacetime adf42551c8 Add rls to the sql api (#2526) 2025-04-02 17:36:20 +00:00
joshua-spacetime 01c391f8a9 Add sql support for :sender parameter (#2483) 2025-03-21 17:53:34 +00:00
joshua-spacetime aeaa7a423d Add support for COUNT (#2285) 2025-02-20 16:37:33 +00:00
joshua-spacetime 6abfe8ddba Add support for LIMIT (#2279) 2025-02-19 20:18:44 +00:00
joshua-spacetime 75ab91d36d Handle optimization and execution errors on initial subscription (#2213) 2025-02-06 19:14:44 +00:00
joshua-spacetime e4e36ec478 Return errors for invariant violations during query planning (#2209) 2025-02-04 21:58:14 +00:00
joshua-spacetime 6aa75bd0eb Track compute metrics for sql dml with new engine (#2190) 2025-01-31 17:59:33 +00:00
joshua-spacetime 4b4484a3aa Track query and datastore cpu usage metrics (#2140) 2025-01-29 21:30:41 +00:00
joshua-spacetime 149ff9760c Query execution updates for cpu metrics (#2130) 2025-01-22 23:29:53 +00:00
joshua-spacetime 3798f468a6 query engine integration (#2074) 2025-01-11 00:01:24 +00:00