NodeGrantDatabaseStorage generate select with syntax error

Created on 24 May 2023, about 1 year ago
Updated 23 February 2024, 4 months ago

Problem/Motivation

Performance issue during using grands system.

Steps to reproduce

Use grands with a lot numbers of node and users + 3000

Code $query = $this->database->select('node_access'); without alias param
generate db query like this: with 2x node_access
SELECT 1 AS "expression"
FROM
"node_access" "node_access"
WHERE ("grant_view" >= '1') ...

sql can handle it, but the query lengthens very much and makes a lock on the table if we have a large number of users.

Proposed resolution

class NodeGrantDatabaseStorage
line 81
$query = $this->database->select('node_access');
and
line 132
$query = $this->database->select('node_access');

replace on

$query = $this->database->select('node_access', 'na');

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡΅πŸ‡±Poland Pawelgorski87

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024