<div dir="ltr"><div>Hi everybody,<br></div><div>My question should be addressed to developers, but I have too many lists, hope someone reads here too.<br></div><div>For the italian cadastre reference point publication [1]I have a large,  postgis table (~1,7 milions rows across Italy) partitioned over an attribute list, so the Primary key is on two fields.</div><div>The date are published with QGIS server but each time the server receive a request (GetMap or GetFeatuerinfo) i noticed that QGIS make a qery to check if the primary key is unique</div><div><br></div><div>SELECT count(distinct ("id","field1"))=count(("id","field1")) FROM "public"."mytable"</div><div><br></div><div>that is stated in this line of code:</div><div><br></div><div><a href="https://github.com/qgis/QGIS/blob/1373d2bcfcc26a834d4a21a0a95187b77f64d4cd/src/providers/postgres/qgspostgresprovider.cpp#L2008">https://github.com/qgis/QGIS/blob/1373d2bcfcc26a834d4a21a0a95187b77f64d4cd/src/providers/postgres/qgspostgresprovider.cpp#L2008</a></div><div><br></div><div>This query is quite slow, is there a way to set up the postgis table or QGIS project to avoid this check?<br></div><div>Thanks<br></div><div><br></div><div>Amedeo Fadini</div><div><br></div><div>[1] <a href="http://www.topgeometri.it">www.topgeometri.it</a><br></div></div>