query-patterns

Teach 1C query language best practices for performance optimization.

87|15|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/SteelMorgan/1c-agent-based-dev-framework --skill query-patterns-steelmorgan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-patterns
Source: https://github.com/SteelMorgan/1c-agent-based-dev-framework/tree/main/framework/skills/bsl-practices/query-patterns
Command: npx skills add https://github.com/SteelMorgan/1c-agent-based-dev-framework --skill query-patterns-steelmorgan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical performance issues in 1C:Enterprise applications caused by inefficient database queries, helping developers write faster and more reliable code.

Core Features & Use Cases

  • Query Best Practices: Teaches essential rules for writing optimized 1C query language statements.
  • Performance Tuning: Provides concrete examples and explanations for avoiding common pitfalls like N+1 query problems and improper NULL handling.
  • Use Case: A developer is experiencing slow report generation. By consulting this Skill, they learn to refactor a loop-based query into a single, efficient query, drastically improving report load times.

Quick Start

Explain rule number 1 about avoiding queries in loops.

Frequently Asked Questions about query-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize 1C query performance for slow report generation?

To optimize 1C query performance, refactor loop-based queries into single batch operations and use temporary tables. This prevents N+1 query bottlenecks and improves report load times.

What is the best way to handle NULLs in 1C LEFT JOIN queries?

The best way to handle NULLs in 1C LEFT JOIN queries is to apply explicit NULL checks in join conditions. Proper parameterization and NULL handling ensure accurate results without degrading database performance.

Why does avoiding DISTINCT in 1C query language improve database optimization?

Avoiding DISTINCT in 1C query language improves database optimization because it forces the database to perform unnecessary sorting. Selecting specific fields and structuring joins yields distinct results more efficiently.

When do I need to use the EXPRESSION construct in 1C:Enterprise?

You need to use the EXPRESSION construct in 1C:Enterprise when querying fields with composite types. It safely casts specific data types, preventing runtime errors and ensuring query reliability.

How to optimize virtual table usage in 1C:Enterprise database interactions?

To optimize virtual table usage in 1C:Enterprise, apply proper parameterization and limit results early. Incorrectly filtered virtual tables cause severe performance bottlenecks, so always define tight boundary conditions.