How to create good prompts v4

The quality and accuracy of the answers that AI Copilot provides depend on the quality of your prompt. AI Copilot works best if it has large context around a question, details or specifics about the situation, and examples. The more detailed and precise you can make your prompt, the better the answers will be.

Like with other language models, you can use prompt engineering techniques with AI Copilot to improve your query input.

Data considerations

All prompts inserted in the chatbot are stored in an EDB-managed backend database and stored by the AI service provider.

Don't enter sensitive information like full names, user names, passwords, and addresses into the chatbot.

Example queries

Important

Before applying any suggested solutions in production environments, we strongly recommend testing the solutions in a controlled test environment to ensure the proposed fixes align with your specific migration requirements.

Asking a general question

Neutral prompt

What tools are there to migrate databases? 

Since AI Copilot is trained on EDB product documentation and knowledge base, this general question will still give you an answer in the context of EDB's product offerings. However, the chatbot focuses on the most common use case, migrating from an Oracle database to a Postgres database, which might not be your use case.

To improve this prompt, be more specific about the source and target databases.

Better prompt

What tools does EDB provide to migrate from open-source Postgres to EDB Postgres Advanced Server? 

This prompt will produce a more accurate answer, listing EDB's product offerings that support that specific use case.

You can then continue the conversation by adding more questions or context, for example:

What is the difference between the Migration Portal and the Migration Toolkit?

Finding a solution for a syntax error

When the Migration Portal finds a syntax issue, it flags a line with the problem.

Syntax error message

You can ask a general question to gain more knowledge about the query, for example:

What are type casts in Postgres? 
How do I use `SYS.ODCIVARCHAR2LIST`?

You can ask AI Copilot to correct a query with a syntax error. In this case, copy the entire query that contains the line with the issue:

Can you correct the syntax of this query? `CREATE OR REPLACE VIEW HRPLUS.VW_STRING_LIST (STRING_VAL) AS SELECT COLUMN_VALUE FROM SYS.ODCIVARCHAR2LIST('a','b', 'c');`

Alternatively, you can request an EDB Postgres Advanced Server target equivalent for an Oracle source query:

Can you provide an EDB Postgres Advanced Server-compatible equivalent for `CREATE OR REPLACE FORCE EDITIONABLE VIEW "HRPLUS"."VW_STRING_LIST" ("STRING_VAL") AS SELECT "COLUMN_VALUE" FROM SYS.ODCIVARCHAR2LIST('a','b', 'c');`

Both prompts will suggest a similar syntax to create an EDB Postgres Advanced Server-compatible view:

CREATE OR REPLACE VIEW HRPLUS.VW_STRING_LIST (STRING_VAL) AS
  SELECT UNNEST(ARRAY['a','b', 'c']) AS COLUMN_VALUE;

Understanding an imprecise syntax error

Sometimes, the Migration Portal provides an imprecise or vague error message for a syntax issue:

Imprecise syntax error message

You can ask AI Copilot to explain the issue:

What is the issue with the following argument when used in a Postgres query? `PIVOT ( COUNT(expense_type_id) FOR expense_type_id IN (10, 20, 30) ) ORDER BY employee_ref;`

And to suggest an equivalent:

Can you provide a Postgres-compatible version of this Oracle query? `SELECT EMPLOYEE_REF,"10","20","30" FROM ( SELECT employee_ref, expense_type_id FROM expenses ) PIVOT ( COUNT(expense_type_id) FOR expense_type_id IN (10, 20, 30) ) ORDER BY employee_ref;`

The suggestions generated by AI Copilot for these example prompts are different. In this case, the recommended path is to use the provided suggestions to create an equivalent query. Then test the behavior of the original against the created query, and ensure the target query fulfills the original purpose before using it in production.