pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ben <bentenzha@outlook.com>
Cc: Jerry Sievers <gsievers19@comcast.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Obvious data mismatch in View2 which basically SELECT * from View1
Date: Thu, 17 Sep 2020 14:59:47 -0400
Message-ID: <236993.1600369187@sss.pgh.pa.us> (raw)
In-Reply-To: <MWHPR06MB2400E1FA4AAD12440EA96B79B93E0@MWHPR06MB2400.namprd06.prod.outlook.com>
References: <6db031b4-58fa-466c-b73d-1dc0a4bf97d6@outlook.com>
	<MWHPR06MB24005D602C007214E610B44FB93E0@MWHPR06MB2400.namprd06.prod.outlook.com>
	<87zh5opis3.fsf@jsievers.enova.com>
	<MWHPR06MB2400E1FA4AAD12440EA96B79B93E0@MWHPR06MB2400.namprd06.prod.outlook.com>

Ben <bentenzha@outlook.com> <MWHPR06MB2400E1FA4AAD12440EA96B79B93E0@MWHPR06MB2400.namprd06.prod.outlook.com> writes:
> You are right none of them is what I originally used to create them 
> which should be
> `select * from utlog.stats_per_shift_filtered_b0206`, but they do look 
> different,

This discrepancy could explain a lot:

>       (stats_per_shift_filtered_u0206.wsft)::character varying AS wsft,

vs

>       stats_per_shift_filtered_b0206.wsft,

Your problem query has a WHERE clause testing wsft, so this difference
is subtly affecting what that WHERE clause means.  That could result in
a plan change, thereby changing the row output order, which as already
noted would be sufficient to explain the inconsistency.

If I had to bet I'd suspect that the extra cast is blocking use of an
index on wsft.

			regards, tom lane





view thread (9+ messages)

Message-ID: <236993.1600369187@sss.pgh.pa.us>
Permalink:  ../236993.1600369187@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/236993.1600369187@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bentenzha@outlook.com, gsievers19@comcast.net
  Subject: Re: Obvious data mismatch in View2 which basically SELECT * from View1
  In-Reply-To: <236993.1600369187@sss.pgh.pa.us>
  References: <6db031b4-58fa-466c-b73d-1dc0a4bf97d6@outlook.com> <MWHPR06MB24005D602C007214E610B44FB93E0@MWHPR06MB2400.namprd06.prod.outlook.com> <87zh5opis3.fsf@jsievers.enova.com> <MWHPR06MB2400E1FA4AAD12440EA96B79B93E0@MWHPR06MB2400.namprd06.prod.outlook.com> <236993.1600369187@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox