Answer the question
In order to leave comments, you need to log in
What should I pay attention to when migrating from MySQL to PostgreSQL?
We are developing our project in the company with a bunch of internal services, CRM, Task manager, etc. The whole thing interacts quite closely with 1c, which is based on PosgreSQL, but at the same time, the main MySQL database (because I have more experience working with it, I know along and across)
At this stage, due to the expansion of functionality, deeper integration was needed, and accordingly, either once again complicate the synchronization mechanisms, or transfer everything that is directly to Posgre, especially since the database itself has much more capabilities. Then there is no point in synchronization, it will be possible to work in a scheme adjacent to 1s and use foreign keys and tricky views.
Accordingly, the question is for people who imagine the intricacies of such a transition: what should I pay attention to during tests, what can be pitfalls?
It is also confusing that posgre is patched to work with 1s, and the most serious consequence is the absence of managed locks, only table locks.
The requests themselves only need to be slightly edited and the class for working with the database is rewritten (a small add-on to make it more convenient to work with). Users: about 40 people, the load (for 1s) is about 3 requests per second (now I measure it more accurately at active work with more active synchronization).
Answer the question
In order to leave comments, you need to log in
eeeh, he asked himself answered)
So, what actually needs to be paid attention to:
- change date_format(now() '%d.%m.%Y'); to_char( now(), 'DD.MM.YYYY' );
- if you need to use unix_timestamp() (I use it to pass the dateDiff function to PHP), then we write:
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp without time zone)
RETURNS integer AS
$BODY$
SELECT date_part('epoch', $1::timestamp)::INTEGER AS RESULT
$BODY$
LANGUAGE sql VOLATILE
COST 100;
private static function getPrepared()
{
$result=pg_query(self::$pgConn, 'SELECT name FROM pg_prepared_statements');
while ($data=pg_fetch_object($result))
{
self::$prepareds[(string)$data->name]=1;
}
}
//mydb - имя источника данных заданное в 1с
Параметры = ВнешниеИсточникиДанных.mydb.ПолучитьОбщиеПараметрыСоединения();
Параметры.АутентификацияСтандартная = Истина;
Параметры.ИмяПользователя = "user";
Параметры.Пароль = "password";
Параметры.СтрокаСоединения = "DRIVER={PostgreSQL Unicode(x64)};SERVER=127.0.0.1;port=5432;UID=user;PWD=password;DATABASE=somedb";
Параметры.СУБД = "PostgreSQL";
ВнешниеИсточникиДанных.mydb.УстановитьОбщиеПараметрыСоединения(Параметры);
ВнешниеИсточникиДанных.mydb.УстановитьПараметрыСоединенияПользователя(ИмяПользователя(), Параметры);
ВнешниеИсточникиДанных.mydb.УстановитьПараметрыСоединенияСеанса(Параметры);
ВнешниеИсточникиДанных.mydb.УстановитьСоединение();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question