0

We have two environment staging and production. For Database service we are using AWS RDS(postgresql).

SELECT * 
FROM addressfabric_v2_2022_7 
WHERE ST_Intersects(ST_GeomFromText('POLYGON((-75.7891846 45.2530176,-75.2783203 45.2568822,-74.9981689 45.3688422,-75.0750732 45.5613573,-75.7397461 45.6113035,-75.7891846 45.2530176))',4326),geometry)  
limit 20 offset 180 

We are getting different response for above query on staging and production. Data and RDS configuration on both environments are exactly same.

Query Plan:Staging

enter image description here



Query Plan:Production

enter image description here

Same query is behaving differently on staging and production environment.

I have also checked the value of "max_parallel_workers_per_gather". On both environment it is 4.

  • Execution plans are better shared as formatted text generated using explain (analyze, buffers, format text) Screen shots of some graphical representation simply hide way too many details. –  Aug 29 '22 at 12:35

1 Answers1

2

Since you specify no ORDER BY in your queries, the DBMS is free to return rows in any order it sees fit, so it's no surprise you get different results. You might even get different results in the same environment now and then.

If you want deterministic results, use a deterministic order.

mustaccio
  • 25,896
  • 22
  • 57
  • 72