Hello,
Things to Try Before You Post
-> I went through these steps and they did not bring any difference.
Information You Need To Include
Postgres version
"PostgreSQL 10.6 on x86_64-pc-linux-gnu, compiled by gcc (Debian
6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit"
Full Table and Index Schema
The difference is very bad for the new company, even on the simplest query
SELECT * FROM CompanyArticleDB
WHERE CompanyId = '77'
AND ArticleId= '7869071'
Table "public.companyarticledb"
Column |Type | Collation |
Nullable | Default
+-+---+--+-
companyid | integer | | not
null |
articleid | integer | | not
null |
price | numeric(19,4) | |
|
contractstartdate | timestamp without time zone | |
|
contractenddate| timestamp without time zone | |
|
enabled| boolean | |
|
visible| boolean | |
|
sheid | integer | |
|
inmassbalance | boolean | |
|
internalwastetype | character varying(50) | |
|
buom | character varying(50) | |
|
stockunit | numeric(18,2) | |
|
priceperbuom | numeric(19,4) | |
|
purchaseunit | numeric(18,2) | |
|
preventioncounselorid | integer | |
|
licenseprovided| boolean | |
|
licensevaliduntil | timestamp without time zone | |
|
authorisationlocationid| integer | |
|
priceagreementreference| character varying(50) | |
|
interfaceaccountid | integer | |
|
createdon | timestamp without time zone | |
|
modifiedby | integer | |
|
createdby | integer | |
|
modifiedon | timestamp without time zone | |
|
createdonsupplier | timestamp without time zone | |
|
modifiedbysupplier | integer | |
|
createdbysupplier | integer | |
|
modifiedonsupplier | timestamp without time zone | |
|
newprice | numeric(19,4) | |
|
newcontractstartdate | timestamp without time zone | |
|
newcontractenddate | timestamp without time zone | |
|
newpriceagreementreference | character varying(50) | |
|
licensereference | character varying(50) | |
|
purchasercomment | character varying(500) | |
|
reportingunit | character varying(5)| |
|
articlecode| character varying(50) | |
|
participantdescription | character varying(500) | |
|
motivationneeded | boolean | |
|
photourl | character varying(500) | |
|
reviewedshe| boolean | |
|
noinspectionuntil | timestamp without time zone | |
|
priority | boolean | |
|
needschecking | boolean | |
|
role | character varying(20) | |
|
Indexes:
"pk_pricedb" PRIMARY KEY, btree (companyid, articleid)
"EnabledIndex" btree (enabled)
"ix_companyarticledb_article" btree (articleid)
"ix_companyarticledb_company" btree (companyid)
"participantarticlecodeindex" btree (articlecode)
"participantdescriptionindex" gin (participantdescription gin_trgm_ops)
Foreign-key constraints:
"fk_companyarticledb_accountsdb" FOREIGN KEY (modifiedby) REFERENCES
accountsdb(id)
"fk_companyarticledb_accountsdb1" FOREIGN KEY (createdby) REFERENCES
accountsdb(id)
"fk_companyarticledb_accountsdb2" FOREIGN KEY (preventioncounselorid)
REFERENCES accountsdb(id)
"fk_companyarticledb_articledb" FOREIGN KEY (articleid) REFERENCES
articledb(id)
"fk_companyarticledb_companydb" FOREIGN K