Re: Suboptimal plan when IN(...), ORDER BY and LIMIT are used (no JOINs)

2021-04-14 Thread Dmitry Koterov
Yeah, that was a plan for a query before its simplification. But effect is still the same, and also the question is still the same - why a bitmap scan is preferred over a number of individual index scans with fetching first 50 elements from each. (Also, replacing LIMIT 50 to LIMIT 2 doesn't seem to

Re: Suboptimal plan when IN(...), ORDER BY and LIMIT are used (no JOINs)

2021-04-14 Thread Michael Lewis
Your query and explain analyze output do not seem to match. Filter: (cred_id = '1001344096118566254'::bigint) I don't see anything like that in your query, nor an index that would support accomplishing that without filtering after fetching the 184k rows initially like the planner does. >

Re: Timestamp/hstore query?

2021-04-14 Thread Brent Wood
Thanks for your reply, The table is essentially:create table readings (timer    timestamp primary key,    readings  hstore); the hstore comprises ( ) key/value pairs for readings taken at the time specified in the timestamp. eg:  "67" "-45.67436", "68" "176.5424" could be key/

Re: Timestamp/hstore query?

2021-04-14 Thread Michael Lewis
If you share example schema and desired output (like a dummy table or even pseudo code SQL), then I'm sure many people could help you. Right now, the description of your desired result seems a bit unclear, at least to me. If you wanted to run this hourly for the last 1 hour, it sounds a bit like

Timestamp/hstore query?

2021-04-14 Thread Brent Wood
Hi, I have a database with instrument readings stored in hstore key-value pairs, so a record has a timestamp attribute and an hstore attribute with all the sensor readings for that time. The key identifies the sensor, the value is the reading. Not all sensors have a reading at every timestamp.

Re: Question about PG_CONTROL_VERSION 1

2021-04-14 Thread Tom Lane
Condor writes: > I try restore from old hard drive an database. The system is not > working, so I install new server, install postgres 9.0.3 and try to copy > postgresql dir to new location but I receive error: > 2021-04-14 11:47:04.205 UTC [10285] FATAL: database files are > incompatible wit

Question about PG_CONTROL_VERSION 1

2021-04-14 Thread Condor
Hello, I try restore from old hard drive an database. The system is not working, so I install new server, install postgres 9.0.3 and try to copy postgresql dir to new location but I receive error: 2021-04-14 11:47:04.205 UTC [10285] FATAL: database files are incompatible with server 2021-04

Re: Why is writing JSONB faster than just JSON?

2021-04-14 Thread Tom Lane
Dmitry Dolgov <9erthali...@gmail.com> writes: >> On Tue, Apr 13, 2021 at 11:38:04PM -0700, Mitar wrote: >> ... Namely, it looks like writing into a jsonb typed >> column is 30% faster than writing into a json typed column. Why is >> that? Does not jsonb require parsing of JSON and conversion? That

View invoker privileges

2021-04-14 Thread m7o...@gmail.com
Hello guys! In Postgres we can create view with view owner privileges only. What’s the reason that there is no option to create view with invoker privileges? Is there any technical or security subtleties related to absence of this feature?

Re: Why is writing JSONB faster than just JSON?

2021-04-14 Thread Dmitry Dolgov
> On Tue, Apr 13, 2021 at 11:38:04PM -0700, Mitar wrote: > Hi! > > I have a project where we among other data want to store static JSON > objects which can get pretty large (10-100 KB). I was trying to > evaluate how it would work if we simply store it as an additional > column in a PostgreSQL data