Problem/Motivation

In #2755831: Make keyvalue and config stores for database faster by using upsert OR get() before set() we would like to change the merge query for an upsert query. As upsert queries have only one roundtrip to the database and merge queries have multiple roundtrips to the database

Proposed resolution

Change the upsert query to allow an array of fields names as the key.

Remaining tasks

Write patch
Review patch

User interface changes

None

API changes

Deprecate the method Drupal\Core\Database\Query\Upsert::key($field) and add the method Drupal\Core\Database\Query\Upsert::keys($fields)

Data model changes

None

Release notes snippet

TBD

CommentFileSizeAuthor
#2 3191465-2.patch9.94 KBdaffie

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
StatusFileSize
new9.94 KB
daffie’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: 3191465-2.patch, failed testing. View results

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

catch’s picture

Status: Needs work » Closed (duplicate)

Marking this as duplicate of #2547493: Add support for unique / primary key constraints composed of multiple fields for Upsert queries it's both older and has much more recent activity.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.