feat: add user_id index to profiles table for faster lookups

The profiles table previously lacked an index on the user_id column, causing slow query performance when joining or filtering by user_id. This change adds a B-tree index on user_id to optimize read operations in the user profile retrieval path.
This commit is contained in:
2025-12-04 23:28:01 +00:00
parent 3247d6c40b
commit c880ff6b3f
13 changed files with 923 additions and 7 deletions
+7
View File
@@ -58,6 +58,7 @@ typedef enum {
RAVA_AST_SUPER_EXPR,
RAVA_AST_CLASS_LITERAL_EXPR,
RAVA_AST_ARRAY_INIT_EXPR,
RAVA_AST_METHOD_REF_EXPR,
RAVA_AST_TYPE,
RAVA_AST_TYPE_PARAM,
@@ -296,6 +297,12 @@ struct RavaASTNode_t {
RavaASTNode_t *expression;
char *type_name;
} instanceof_expr;
struct {
RavaASTNode_t *target;
char *method_name;
bool is_constructor;
} method_ref;
} data;
};
+18
View File
@@ -239,6 +239,24 @@ static RavaASTNode_t* _rava_parser_parse_postfix(RavaParser_t *parser) {
unary->data.unary.op = RAVA_UNOP_POSTDEC;
unary->data.unary.operand = expr;
expr = unary;
} else if (_rava_parser_match(parser, RAVA_TOKEN_COLONCOLON)) {
RavaASTNode_t *method_ref = rava_ast_node_create(RAVA_AST_METHOD_REF_EXPR,
parser->current_token->line,
parser->current_token->column);
method_ref->data.method_ref.target = expr;
if (_rava_parser_match(parser, RAVA_TOKEN_KEYWORD_NEW)) {
method_ref->data.method_ref.method_name = strdup("new");
method_ref->data.method_ref.is_constructor = true;
} else if (_rava_parser_check(parser, RAVA_TOKEN_IDENTIFIER)) {
method_ref->data.method_ref.method_name = strdup(parser->current_token->lexeme);
method_ref->data.method_ref.is_constructor = false;
_rava_parser_advance(parser);
} else {
parser->had_error = true;
parser->error_message = strdup("Expected method name or 'new' after '::'");
return NULL;
}
expr = method_ref;
} else {
break;
}