File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -539,7 +539,12 @@ middle_query_pgsql_t::middle_query_pgsql_t(
539539 std::string const &conninfo, std::shared_ptr<node_ram_cache> const &cache,
540540 std::shared_ptr<node_persistent_cache> const &persistent_cache)
541541: m_sql_conn(conninfo), m_cache(cache), m_persistent_cache(persistent_cache)
542- {}
542+ {
543+ // Disable JIT and parallel workers as they are known to cause
544+ // problems when accessing the intarrays.
545+ m_sql_conn.set_config (" jit_above_cost" , " -1" );
546+ m_sql_conn.set_config (" max_parallel_workers_per_gather" , " 0" );
547+ }
543548
544549void middle_pgsql_t::start ()
545550{
@@ -554,6 +559,11 @@ void middle_pgsql_t::start()
554559 }
555560
556561 if (m_append) {
562+ // Disable JIT and parallel workers as they are known to cause
563+ // problems when accessing the intarrays.
564+ m_db_connection.set_config (" jit_above_cost" , " -1" );
565+ m_db_connection.set_config (" max_parallel_workers_per_gather" , " 0" );
566+
557567 // Prepare queries for updating dependent objects
558568 for (auto &table : m_tables) {
559569 if (!table.m_prepare_intarray .empty ()) {
Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ pg_result_t pg_conn_t::query(ExecStatusType expect,
4141 return query (expect, sql.c_str ());
4242}
4343
44+ void pg_conn_t::set_config (char const *setting, char const *value) const
45+ {
46+ // Update pg_settings instead of using SET because it does not yield
47+ // errors on older versions of PostgreSQL where the settings are not
48+ // implemented.
49+ auto const sql =
50+ " UPDATE pg_settings SET setting = '{}' WHERE name = '{}'" _format (
51+ setting, value);
52+ query (PGRES_TUPLES_OK, sql);
53+ }
54+
4455void pg_conn_t::exec (char const *sql) const { query (PGRES_COMMAND_OK, sql); }
4556
4657void pg_conn_t::exec (std::string const &sql) const
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ class pg_conn_t
123123
124124 pg_result_t query (ExecStatusType expect, std::string const &sql) const ;
125125
126+ void set_config (char const *setting, char const *value) const ;
127+
126128 void exec (char const *sql) const ;
127129
128130 void exec (std::string const &sql) const ;
You can’t perform that action at this time.
0 commit comments