sql.moscowQueries · reports · migration
sql.moscow / DEVELOPMENT AND OPTIMIZATIONPostgreSQL · Greenplum · Oracle

Complex SQL.
Clear results.

Help with SQL queries, errors, reports, data exports, PostgreSQL, Greenplum, Oracle PL/SQL and migration of SQL logic between database management systems.

query.sqlExample query
SELECT department,
       COUNT(*) AS total
FROM requests
WHERE created_at >=
      CURRENT_DATE - INTERVAL '30 days'
GROUP BY department;
Illustrative example · no real data
Before work begins

We start with the task and a reproducible example.

Send the query, error message, DBMS version and an anonymized example. Passwords, access keys and real personal data are not needed.

How to submit a task ↗
Services

Services you can order

service

SQL query fixes

Errors in syntax, types, JOIN, GROUP BY, CTE and window functions, duplicate rows, incorrect totals and empty results.

from 5 000 ₽
service

Query optimization

Analysis of slow queries, rewriting JOIN operations and subqueries, and recommendations on indexes and execution plans.

from RUB 15,000
service

PostgreSQL / Greenplum

PL/pgSQL, functions, temporary tables, analytical queries, Greenplum specifics, type errors and result structure errors.

from RUB 15,000
service

Oracle PL/SQL → PostgreSQL

Migration of SQL logic, functions and procedures: DECODE, NVL, dates, MERGE, cursors, packages, PL/pgSQL.

from RUB 25,000
service

Reports and data exports

SQL queries for Excel, BI, CRM, ERP, sales, inventory, customers, payments, documents and data reconciliation.

from RUB 10,000
service

SQL code audit

Reviewing SQL written by others, finding errors, simplifying logic, adding comments, documenting and rewriting queries.

from RUB 20,000
SQL errors

Query fixes and error analysis

You can send the query text, error, table definitions and expected result. Database access is not always required.

  • relation does not exist
    Checking schemas, table names, case sensitivity, search_path and execution context.
  • column does not exist
    Checking aliases, JOIN, CTE, nested queries and scope.
  • structure of query does not match
    Fixing return types and column order in PostgreSQL functions.
  • syntax error at or near
    Finding syntax errors, DBMS incompatibilities and invalid constructs.
  • duplicates and incorrect totals
    Checking JOIN operations, groupings, aggregations and data granularity.
  • slow query
    Analyzing logic, unnecessary subqueries, filters, indexes and execution plans.
Migration

Oracle PL/SQL → PostgreSQL / Greenplum

Migrating SQL logic requires adapting functions, types, dates, procedural logic and DBMS behavior rather than mechanically replacing words.

Common in Oracle

  • DECODE
  • NVL
  • MERGE
  • CONNECT BY
  • PL/SQL packages
  • cursor-based logic

Adaptation

  • CASE
  • COALESCE
  • INSERT ON CONFLICT / separate logic
  • WITH RECURSIVE
  • PL/pgSQL functions
  • set-based approach
Greenplum: migration must take account of data distribution, UPDATE/DELETE restrictions, temporary tables, functions and the specifics of MPP architecture.
Reports

SQL data exports for analytics and business

Preparing queries to export data on sales, customers, inventory, payments, documents, products, groups, periods and statuses.

  • Excel / CSV
    A query tailored to the required export structure.
  • Power BI / BI
    Preparing datasets and analytical data marts.
  • CRM / ERP
    Queries for customers, documents, deals and payments.
  • Data reconciliation
    Finding duplicates, discrepancies, omissions and aggregation errors.
Pricing

SQL task pricing

Initial task reviewfrom 3 000 ₽
Fixing a simple SQL queryfrom 5 000 ₽
Developing an SQL data exportfrom RUB 10,000
Optimizing a slow queryfrom RUB 15,000
PL/pgSQL functionfrom RUB 20,000
Oracle PL/SQL → PostgreSQL migrationfrom RUB 25,000
SQL code auditfrom RUB 20,000
Urgent taskquoted individually

The final cost depends on the DBMS, amount of code, availability of table schemas, urgency, testing requirements and complexity of the business logic.

How the work proceeds

Work process

1. You send the task

The query, error, DBMS, table structures, expected result and constraints.

2. The logic is clarified

What data is needed, how the result is calculated, and where an error or slowdown occurs.

3. A solution is prepared

Corrected SQL, explanations, recommendations and, where needed, optimization options.

FAQ

Frequently asked questions

Can you help without database access?

Yes. For an initial review, the query text, error, table structures and expected result are often sufficient. For optimization, an execution plan and an indication of data volumes are desirable.

Can Oracle SQL be rewritten for PostgreSQL?

Yes. Differences in functions, data types, dates, procedural logic and syntax must be taken into account. Sometimes a change of approach is needed rather than a direct replacement.

Can a query be made faster?

Yes, with the query text, table structures, an indication of data volumes and preferably EXPLAIN / EXPLAIN ANALYZE. Recommendations on indexes and rewriting the logic can also be provided.

Can you create a data export for Excel or BI?

Yes. An SQL query can be prepared for the required fields, filters, groupings, periods and result format.

How to check a corrected query and compare performance

Before changing SQL, it is useful to record what constitutes a correct result: the set of columns, selection rules, level of detail, permissible duplicates and how totals are calculated. A test example includes a small schema, anonymized records and the expected result. This set helps distinguish a syntax error from a misunderstanding of the report.

Optimization checks have two parts. First, the results of the original and modified queries are compared: row counts, keys, control totals for metrics and disputed examples. Measurements are then compared on an agreed volume of data. A fast response that loses rows is not considered a useful optimization result.

  • The DBMS version, query parameters and typical table sizes are specified.
  • The execution plan, measurement conditions and information about concurrent workload are saved.
  • For index changes, the proposed commands and associated constraints are described.
  • The final explanations distinguish the corrected logic, the effect achieved and the remaining bottlenecks.

In PostgreSQL, EXPLAIN ANALYZE actually executes the query being examined. Its use with operations that modify data and with resource-intensive queries is therefore agreed in advance; a prepared test copy is preferable. A plan without actual execution data is useful for an initial review, but does not replace checking the resulting output in a working scenario.

What to compare when migrating SQL logic between database management systems

The migration of a report or procedure is assessed by its behavior on agreed data. In addition to successful execution, checks cover the rules for missing values, type conversion, rounding, dates and time boundaries. Even a small change to a join condition or filter can alter the final totals in a query that looks similar.

Migration verification set

  1. The original SQL or procedure code, with a description of the parameters and expected result.
  2. The structure of the tables used, column types, constraints and dependencies on other functions.
  3. Examples of normal and boundary data: a missing record, duplicate, empty value, date rollover, and negative or zero amount.
  4. The original system's results for these examples and an explanation of significant business rules.
  5. Execution conditions: frequency, data volume, permissible execution time and access restrictions.

If a procedure modifies data, the sequence of operations, error handling and state of the tables after an incomplete run are examined separately. For reporting queries, the same granularity is checked: results per document, document line or group of objects. These levels must not be changed without making it clear when rewriting a query.

After migration, it is useful to retain the SQL script, a list of changes and reference results. Unresolved dependencies are explicitly noted: for example, a called function has not been provided or the rule for populating a field is unknown. This list allows work to resume from a specific question and further verification to be agreed without sharing unnecessary production data or access credentials.

Inquiry

Send your SQL task for review

Include the query text, error, table structures, DBMS and expected result. You can start without database access, using code and a description.

  • fixing an SQL query;
  • optimizing a slow report;
  • migrating Oracle PL/SQL;
  • a data export for Excel, BI, CRM or ERP.
SQL, PostgreSQL, Greenplum, Oracle PL/SQL, reports and data exportsrequest@sql.moscow
Write to usDiscuss your task ↗