Skip to content

Avoiding non-index searches #15

@mario-campos

Description

@mario-campos

Searching table columns that have not been indexed will typically result in a full table scan. This can be very slow and resource-intensive, increasing the likelihood of performance bottlenecks.

Example scenario

The following SQL will result in a full table scan if some_column is not indexed:

BEGIN TRANSACTION;
SELECT * FROM my_table WHERE some_column = 'some_value';
-- More actions here, then:
COMMIT TRANSACTION;

Example prompt

How can I optimize this transaction?

Source: https://docs.github.com/en/copilot/copilot-chat-cookbook/refactoring-code/fixing-database-deadlocks-or-data-integrity-issues#avoiding-non-index-searches

Metadata

Metadata

Assignees

No one assigned

    Labels

    SQLExercise includes a SQL query

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions