Re: Barman disaster recovery solution

2019-02-27 Thread David Steele
archiving. If something then happens to the primary then your recovery point will be limited. Regards, -- -David da...@pgmasters.net

Re: Barman disaster recovery solution

2019-02-27 Thread David Steele
On 2/27/19 4:48 PM, Achilleas Mantzios wrote: On 27/2/19 4:16 μ.μ., David Steele wrote: On 2/27/19 2:31 PM, Achilleas Mantzios wrote: On 27/2/19 1:58 μ.μ., rich...@simkorp.com.br wrote: Just to notice, I d o use backup from standby and WAL archive from standby. It is possible. But you have to

Re: Barman disaster recovery solution

2019-02-28 Thread David Steele
On 2/28/19 9:21 AM, Achilleas Mantzios wrote: On 28/2/19 1:08 π.μ., Ahmed, Nawaz wrote: Hi, I believe the "file copy" method (listed in the table) in pgbackrest is based on pg_basebackup, so i think it should be "pg_basebackup over ssh" as pgbackrest internally calls

Re: Pgbackrest Comparability issue

2019-03-01 Thread David Steele
/user-guide.html#installation You may have files in other locations as well since I don't believe /bin/pgbackrest has even been in our install directions. Regards, -- -David da...@pgmasters.net

Re: Barman disaster recovery solution

2019-03-01 Thread David Steele
`stop-auto` option since it is not relevant to PG10. https://github.com/pgbackrest/pgbackrest/commit/6ce3310f8a2900d1af717da8d4c3345a9016933b Thanks! -- -David da...@pgmasters.net

Re: delete on table with many partitions uses a lot of ram

2019-03-09 Thread David Rowley
;t be fixed for 12. However, nothing is entirely certain that far out. It's probably best to reduce the number of partitions. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

RE: Permission to refresh materialized view

2019-03-13 Thread Day, David
-Original Message- From: Adrian Klaver [mailto:adrian.kla...@aklaver.com] Sent: Wednesday, March 13, 2019 10:24 AM To: Johann Spies ; pgsql-gene...@postgresql.org Subject: Re: Permission to refresh materialized view On 3/13/19 6:27 AM, Johann Spies wrote: > We did run this query: > > /

Materialized view breaks pg_restore

2019-03-21 Thread David Wheeler
part of our disaster recovery process, so if we find this problem during restore it will mean more downtime. PG version 9.5.14. I’m attempting to find out now if it’s an issue in more recent versions also. TIA David Wheeler Software developer [cid:2C4D0888-9F8B-463F-BD54-2B60A322210C] E dwhe

Re: Column lookup in a row performance

2019-03-22 Thread David Rowley
s, of course, not always possible, but useful to keep in mind when deciding the order to have your columns in the table. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Column lookup in a row performance

2019-03-26 Thread David Rowley
roving TupleDesc so it cached the first attnum without a NOT NULL constraint so that we knew we could use the cached offset before that attnum even if the tuple has NULLs later in the tuple. However, that puts a lot of dependency on the NOT NULL constraint never being wrong. -- David Rowley

Re: Regarding pgaudit log_directory

2019-03-30 Thread David Steele
manipulation of the PostgreSQL logs. Regards, -- -David da...@pgmasters.net

Re: Regarding pgaudit log_directory

2019-03-31 Thread David Steele
On 3/31/19 8:01 PM, Durgamahesh Manne wrote: On Saturday, March 30, 2019, David Steele <mailto:da...@pgmasters.net>> wrote: On 3/29/19 3:32 PM, Durgamahesh Manne wrote:    I could not find parameter related to pgaudit log_directory  . pgAudit does not suppor

Re: Gigantic load average spikes

2019-03-31 Thread David Rowley
efresh, otherwise, you might need to have a look at ungranted locks in pg_locks and see if the number of locks spikes during the refresh. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

PostgreSQL Windows 2019 support ?

2019-04-03 Thread david moloney
Hi, Is PostgreSQL 10+ supported on windows 2019 ? If not is there a rough time frame for when it will be supported on this OS ? Thanks, David

Re: PostgreSQL Windows 2019 support ?

2019-04-04 Thread david moloney
? Thanks, David From: Andres Freund Sent: Wednesday 3 April 2019 20:12 To: Tom Lane Cc: david moloney; pgsql-gene...@postgresql.org Subject: Re: PostgreSQL Windows 2019 support ? Hi, On 2019-04-03 12:43:25 -0400, Tom Lane wrote: > david moloney writes: >

Re: PostgreSQL Windows 2019 support ?

2019-04-04 Thread David Rowley
On Thu, 4 Apr 2019 at 22:15, david moloney wrote: > Windows 2019 isn’t listed as a supported platform on > https://www.postgresql.org/download/windows/ > > I’m presuming there’s a qualification process before it’s listed here ? Is > this in progress ? That process is having a b

Re: Unable to Vacuum Large Defragmented Table

2019-04-07 Thread David Rowley
hink it is. Remember that variable length attributes can be toasted and stored in the relation's toast table. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Unable to Vacuum Large Defragmented Table

2019-04-07 Thread David Rowley
On Mon, 8 Apr 2019 at 14:19, Igal Sapir wrote: > > On Sun, Apr 7, 2019 at 6:20 PM David Rowley > wrote: >> >> On Mon, 8 Apr 2019 at 10:09, Igal Sapir wrote: >> > >> > I have a table for which pg_relation_size() shows only 31MB, but >> >

Re: Unable to Vacuum Large Defragmented Table

2019-04-07 Thread David Rowley
rge. A normal VACUUM will turn space used by dead tuples back into free space, so if done often enough there won't be a need to vacuum full. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: pg_indexes doesn't show indexes for partitioned tables - bug or intended?

2019-04-10 Thread David Rowley
ded or a bug? Overlooked for PG11. You'll see them in PG12 per [1]. It's not really possible to backpatch a fix for that since these views are created during initdb. [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=f94cec64476f2752e91b10d7928a2fcd105e9fc3 -- David Rowley

Re: Planner can't seem to use partial function indexes with parameter from join

2019-04-14 Thread David Rowley
ion time. The closest thing we have to that is run-time partition pruning in PG11, but that can't help you either since the partition key cannot contain values from other tables. You'd still need to normalise the record table. With that and a partitioned table, there might be further advanta

Re: Error while using pg_dump

2019-04-16 Thread David Rowley
. If for example, you can get it to crash with LIMIT 1, can you send us the psql output of \d public.aclappliedtopep and also some anonymised version of the row it crashes on? (ensuring it still crashes once anonymised). You may be able to narrow it down by "binary searching" through various L

Re: is it possible to create partitioned tables using tables from different schemas

2019-04-17 Thread David Rowley
to assume that though. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: is it possible to create partitioned tables using tables from different schemas

2019-04-17 Thread David Rowley
easurement_automatic" > DETAIL: Specified lower bound (1) is greater than or equal to upper > bound (1). > > OOPS, so lets cheat: Or you could partition by LIST. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Thousands of partitions performance questions

2019-04-28 Thread David Rowley
. If your go-live date is near the end of the year or beyond, then it might be a good idea to start testing with PG12 right away. The release date for that will likely be around the middle of October. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Thousands of partitions performance questions

2019-04-29 Thread David Rowley
. It'll be pretty much the same as if you were querying a normal table. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Starting Postgres when there is no disk space

2019-05-01 Thread David Rowley
partition and ln it back to its original location. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

PG version recommendation

2019-05-07 Thread David Gauthier
Hi: I'm going to be requesting a PG instance supported by an IT team in a large corp. They will be creating the server as a VM. We will be loading the DB using scripts (perl/dbi) on linux, possibly using bulk loading techniques if that's required. Queries will come from both linux and the web,

Re: PG version recommendation

2019-05-07 Thread David Gauthier
>>Home-rolled application, or third party? Are you asking about how they do VMs ? They already provide PG v9.6.7 , so I gather they're not averse to supporting PG DBs. On Tue, May 7, 2019 at 4:05 PM Ron wrote: > On 5/7/19 1:52 PM, David Gauthier wrote: > > Hi: > > I&

Re: perl path issue

2019-05-09 Thread David Steele
y libpq is not installed or > cannot be found on this machine. If pgBackRest was built from source here's the complete dependency list for RHEL7: yum install perl perl-Time-HiRes perl-Digest-SHA perl-DBD-Pg perl-JSON-PP Regards, -- -David da...@pgmasters.net

Re: perl path issue

2019-05-09 Thread David Steele
On 5/9/19 10:57 AM, Prakash Ramakrishnan wrote: > > David am trying to restore the backup in dev server please find the > below details , libpq should be installed with Postgres. Have you installed Postgres yet? -- -David da...@pgmasters.net

Re: perl path issue

2019-05-09 Thread David Steele
On 5/9/19 11:12 AM, Prakash Ramakrishnan wrote: > Yes, I did.  OK, then I would say something is wrong with your package configuration, but I don't know what it might be. Regards, -- -David da...@pgmasters.net

Re: perl path issue

2019-05-09 Thread David Steele
but I thought pqlib was installed with the server as well. Perhaps not. -- -David da...@pgmasters.net

Re: perl path issue

2019-05-09 Thread David Steele
On 5/9/19 12:58 PM, Adrian Klaver wrote: > On 5/9/19 9:54 AM, David Steele wrote: >> On 5/9/19 12:51 PM, Prakash Ramakrishnan wrote: >>> Hi Adrian, >>> >>> I don't know about that client libraries can you please explain or share >>> me the

Re: perl path issue

2019-05-09 Thread David Steele
r. The custom installer installs stuff in non-standard locations so likely won't work without a lot of tweaking. I don't have any experience with the EDB packages. Devrim? -- -David da...@pgmasters.net

Re: Returning empty on insert

2019-05-16 Thread David Rowley
nd up either NULL or be set to the value of the column's DEFAULT clause, if it has one. You might also want to look at INSERT ON CONFLICT DO NOTHING if you want that INSERT to work in concurrent environments. Docs in https://www.postgresql.org/docs/current/sql-insert.html -- David Row

Re: Returning empty on insert

2019-05-16 Thread David Rowley
7;s in "s". "s" will be an empty relation if "test" does not have any row matching WHERE area = 'test5'. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

Re: Returning empty on insert

2019-05-16 Thread David Rowley
urrent sessions running this at the same time. You could protect against that by doing some advisory locking ( https://www.postgresql.org/docs/11/explicit-locking.html#ADVISORY-LOCKS ), or taking an access exclusive lock on "test". -- David Rowley http://www.2ndQu

Re: pg_stat_user_tables.n_tup_ins empty for partitioned table

2019-05-24 Thread David Rowley
up_ins is always correctly set. > However, I've noted that this behavior applies up to february Did you perhaps reset the stats or failover to a standby around Feb? What does: select stats_Reset from pg_stat_database where datname = current_database(); say? -- David Rowley

Re: Query very different speeds on seemingly similar data

2019-06-04 Thread David Rowley
f performing a sub-query, LEFT JOIN to a query similar to your subquery but after removing the std_stk_key = stock.stk_key condition and adding a GROUP BY std_stk_key. However, that may perform worse if there are many more std_stk_key groups than there are matching rows in stock.stk_key. Experimentatio

Re: Table partition with primary key in 11.3

2019-06-06 Thread David Rowley
efit to users in the same release. You may already be aware, but another use case for such variable-width identifiers was with indirect indexes as discussed in [1] [1] https://www.postgresql.org/message-id/20161018182843.xczrxsa2yd47pnru%40alvherre.pgsql -- David Rowley

Need create table statements from metadata

2019-06-20 Thread David Gauthier
psql (9.6.7, server 9.5.2) on linux. I have 2 DBs, one for dev the other is live. I want to recreate several tables in the dev db using the same metadata found in the live db. But I'm too lazy to manually transcribe everything and that's prone to error anyway. In the past, I would just run pg_d

List tables for a specific schema

2019-06-20 Thread David Gauthier
psql (9.6.7, server 9.5.2) I created a schema in my DB called "dvm". Then I created a table a-la... create table dvm.foo (col1 tedxt); . I see the schema with \dnS+. But I can't see my table using \d. I can see the dable with \d dvm.foo, so it's in there. The first column of the \d output is

Need a DB layout gui

2019-06-24 Thread David Gauthier
Hi: I've been poking around https://wiki.postgresql.org/wiki/Community_Guide_to_PostgreSQL_GUI_Tools to see if there is anything that can read PG metadata in and display it graphically in a gui. You know, the kind of picture that is 1 block per table with 1->many arrows connecting up the primary/

Re: Need a DB layout gui

2019-06-25 Thread David Gauthier
All very good ideas. Thanks to all for the input. I think I'm leaning toward DBeaver. But they're all good. Thanks ! On Tue, Jun 25, 2019 at 5:02 PM Kevin Brannen wrote: > *From:* David Gauthier > > > I've been poking around > ht

Need a referential constraint to a non-unique record

2019-06-25 Thread David Gauthier
I need to create a constraint on a column of a table such that it's value is found in another table but may not be unique in that other table. Example... Let's say the DB is about students and the grades they got for 4 subjects... Math, English, Science, History. But instead of creating 4 records

Re: Trigger function does not modify the NEW value

2019-06-28 Thread David Rowley
> in the updated record is not lower-cased. You'll need a BEFORE trigger, not an AFTER trigger. https://www.postgresql.org/docs/current/sql-createtrigger.html -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

pglogical extension. - 2 node master <-> master logical replication ?

2019-07-02 Thread Day, David
Anyone with a test scripts or link to an example of bi-directional master using pglogical. ? I am led to believe from the documentation that this should be possible. (?) "Limited multi-master support with conflict resolution exists, but mutual replication connections must be added individually" W

Re: what happens if a failed transaction is not rolled back?

2023-04-24 Thread David Wheeler
> On 25 Apr 2023, at 1:47 am, David G. Johnston > wrote: > > There isn't anything special about a failed transaction compared to any other > transaction that you leave open. Now I’m curious. Does it have the same impact on performance that an idle in transaction connec

Trigger questions

2023-05-04 Thread DAVID ROTH
1) Can I create a trigger on a view? 2) Do triggers cascade? Say I have an insert trigger on a table. And, I have an insert trigger on a view that references this table If I do an insert on the view, will both triggers fire?

Re: Return rows in input array's order?

2023-05-09 Thread David Wheeler
> Hi. With an integer identity primary key table, > we fetch a number of rows with WHERE id = ANY($1), > with $1 an int[] array. The API using that query must return > rows in the input int[] array order, and uses a client-side > mapping to achieve that currently. > > Is it possible to maintain

Re: Return rows in input array's order?

2023-05-09 Thread David Wheeler
>> It was only used for small arrays but never noticed any performance issues > > Hmmm, sounds like this would be quadratic though... True, but it’s cpu time not io, which tends to be orders of magnitude slower > I wonder whether the int[] can be turned into a pseudo table with a ROWNUM > ext

Re: Pg 16: will pg_dump & pg_restore be faster?

2023-05-30 Thread David Rowley
we have TidRange scans, to have pg_dump split larger tables into chunks so that they can be restored in parallel. David

Re: Pg 16: will pg_dump & pg_restore be faster?

2023-05-30 Thread David Rowley
nificant when multiple processes are concurrently loading data into the same table." The current text of "PostgreSQL 16 can also improve the performance of concurrent bulk loading of data using COPY up to 300%." does lead me to believe that nothing has been done to improve things when only a single backend is involved. David

Re: Pg 16: will pg_dump & pg_restore be faster?

2023-05-30 Thread David Rowley
On Wed, 31 May 2023 at 14:11, Bruce Momjian wrote: > > On Wed, May 31, 2023 at 02:05:10PM +1200, David Rowley wrote: > > "Relation extensions have been improved allowing faster bulk loading > > of data using COPY. These improvements are more significant when >

Re: speed up full table scan using psql

2023-05-30 Thread David Rowley
red. However, if you do need to do some transformation before loading, then you might want to do that in PostgreSQL. For that, something like: psql -c "copy (select col1,col2,col3+col4 from your_table) to stdout" would allow you to run a query, which you could maybe do your transformations in before importing into Snowflake David

Re: Pg 16: will pg_dump & pg_restore be faster?

2023-06-04 Thread David Rowley
relation at the same time. The release announcement did seem to confirm that there had to be concurrency, so it might be good to not lead anyone else down into thinking that only concurrent cases are faster. I certainly understand that's where the big wins are. I'm fine with your proposed wording. David

Re: Is there any good optimization solution to improve the query efficiency?

2023-06-05 Thread David Rowley
ause the planner thinks the join will only produce 1 row. Unfortunately, extended statistics only help for base relation estimations and do nothing for join estimations, so your best bet might be to just: SET enable_nestloop TO off; for this query. David

Re: pb with join plan

2023-06-20 Thread David Rowley
r, that's all speculation until you provide more details. https://wiki.postgresql.org/wiki/Guide_to_reporting_problems David

Re: pb with join plan

2023-06-20 Thread David Rowley
On Wed, 21 Jun 2023 at 08:34, Marc Millas wrote: > > On Tue, Jun 20, 2023 at 10:14 PM David Rowley wrote: >> >> On Wed, 21 Jun 2023 at 07:42, Marc Millas wrote: >> > But if I do the same with clause one OR clause 2, I have to kill the >> > request after an

Re: pb with join plan

2023-06-20 Thread David Rowley
On Wed, 21 Jun 2023 at 10:26, Marc Millas wrote: > link to the plan with both clauses ORed (the one not finishing) > https://explain.depesz.com/s/jHO2 I'd go with the UNION or UNION ALL idea I mentioned earlier. David

Re: bug or lacking doc hint

2023-06-25 Thread David Rowley
On Mon, 26 Jun 2023 at 03:02, Marc Millas wrote: > When I ask this list, David Rowley suggest to rewrite the SQL, replacing the > OR by a union. > > Fine, this do work, even if a bit complex as the original SQL was a set of > intricate joins. > > > So, either this behavi

Re: Helping planner to chose sequential scan when it improves performance

2023-06-25 Thread David Rowley
_page_cost and effective_cache_size are the main settings which will influence plan A vs plan B. Larger values of effective_cache_size will have the planner apply more seq_page_costs to the index scan. Lower values of effective_cache_size will mean more pages will be assumed to cost random_page_cost. David

Replication between different 15.x minor versions ok?

2023-06-28 Thread David Tinker
Is it ok to use physical replication between different 15.x minor releases (on Ubuntu 22.04)? I haven't been able to find a definitive answer. Thanks.

Re: need explanation about an explain plan

2023-07-02 Thread David Rowley
den the filter to ensure it includes all possible "ladate" values, run the query, then run the query again without the date range filter. I would guess it'll only save you a few percent, but I'm open to being proven wrong. David

Trigger Function question

2023-07-10 Thread DAVID ROTH
In a trigger function, is there a way to get a list of all of the columns in the triggering table? I want to be able to use a single trigger function with multiple tables. Thanks

Re: Trigger Function question

2023-07-10 Thread DAVID ROTH
phe Pettus wrote: > > > > On Jul 10, 2023, at 11:20, DAVID ROTH wrote: > > > > In a trigger function, is there a way to get a list of all of the columns > > in the triggering table? > > You can get the table that the trigger fired on with TG_TABLE_SCHEMA a

Re: Trigger Function question

2023-07-10 Thread DAVID ROTH
Thanks for the example. I have a test trigger now that does that but my application needs all of the columns. > On 07/10/2023 2:31 PM EDT Christophe Pettus wrote: > > > > On Jul 10, 2023, at 11:29, DAVID ROTH wrote: > > > > I want to use a single trigger function

Re: Trigger Function question

2023-07-10 Thread DAVID ROTH
I was hoping that NEW could be treated as a record or as an arrayy similar to pg_argv. > On 07/10/2023 2:31 PM EDT Christophe Pettus wrote: > > > > On Jul 10, 2023, at 11:29, DAVID ROTH wrote: > > > > I want to use a single trigger function to log multiple tabl

Re: Trigger Function question

2023-07-10 Thread DAVID ROTH
I saw your message about a "few" columns and missed the new.* notation. Is there a way to get new.* into a jsonb column? > On 07/10/2023 2:38 PM EDT Christophe Pettus wrote: > > > > On Jul 10, 2023, at 11:37, DAVID ROTH wrote: > > > > Thanks for the ex

Re: Using "exit" to bring "goto" functionality.

2023-07-10 Thread DAVID ROTH
I am a newbe at my current job. They have a separate log table for every table because they want all the columns. I have been looking for a way to go to a common log table without requiring major changes to the application. With your help, I have a proof of principle that I can demonstrate now.

Re: Query take a long time and use no index

2023-07-18 Thread David Rowley
#x27;REPLACE INTO aggregate (channel_id, type, timestamp, value, count) Perhaps that's something like PostgreSQL's INSERT ON CONFLICT [1] David [1] https://www.postgresql.org/docs/current/sql-insert.html

Re: Query take a long time and use no index

2023-07-18 Thread David Rowley
d PostgreSQL 16 will allow more efficient execution of DISTINCT and ORDER BY aggregates by allowing indexed to provide pre-sorted input. In the meantime, the query above will probably help you. David

Re: Effects of dropping a large table

2023-07-19 Thread David Rowley
o do? It sounds to me like it would just create a load of needless WAL from the deletes and the vacuum that cleans up the dead rows each of which is more likely to cause lag problems on the replica servers, which the OP is trying to avoid. David

Re: Re: How to improve the performance of my SQL query?

2023-07-25 Thread David Rowley
ndex on MS_CD is unlikely to be a good idea as that would likely require random access to the heap. It's likely better to perform a table scan and then just filter out the 1% of rows that don't match. Try executing the query after having done: SET enable_seqscan TO off; What plan does it use now? Is that plan faster or slower than the seq scan plan? David

Re: How to improve the performance of my SQL query?

2023-07-25 Thread David Rowley
ok like ms_cd is the primary key of TBL_SHA. If it is then it's very weird that you have 320 rows for MS_CD = 'MLD009'. You have some data corruption if that's the case. I suspect you've just not accurately described the table definition, however. David

Re: How to improve the performance of my SQL query?

2023-07-26 Thread David Rowley
the default since HDDs were common. SSDs are common now and, comparatively to sequential I/O, their random I/O is faster than that of an HDD, so you may get better results by lowering random_page_cost. David

PORT 5432 ERROR

2023-08-01 Thread David Beck
gre version 7.4. Version 10 works on port 5434 though the server list tree spins eternally. Any solution or assistance would be appreciated. Best regards, David Beck

Re: pb with big volumes

2023-08-10 Thread David Rowley
is can stuff occur. The slowdown isn't linear. I've no idea if this is happening for the reported case. I'm just saying that it can happen. The OP should really post the results of: SET track_io_timing = ON; EXPLAIN (ANALYZE, BUFFERS) for both queries running independently then again when they run concurrently. David David

Re: pb with big volumes

2023-08-13 Thread David Rowley
rom the kernel's cache or from disk. You'll probably want to calculate the average time it took to get 1 buffer for each query to make sense of that. David

Query plan regression between CTE and views

2023-08-14 Thread David Gilman
estion is: is this a valid bug? I am not sure if I should expect the view version to find a way to materialize and produce a comparable query plan. Also, making a minimal test case is going to take a bit and I don't want to start unless this smells like a genuine bug. -- David Gilman :DG<

How to optimize PostgreSQL Row Security Policies that involve related tables?

2023-08-14 Thread David Ventimiglia
have both the desired composability and also good performance? I hope I've explained this well enough. I asked this question a while back on StackOverflow <https://stackoverflow.com/questions/76525562/how-to-optimize-postgresql-row-security-policies-that-involve-related-tables> but got no interest. I also have sample code in a public GitHub repository here <https://github.com/dventimihasura/hasura-projects/tree/master/rls-optimization-1> that illustrates the setup. Any advice would be greatly appreciated. Thank you! Kind regards, David A. Ventimiglia

Re: How to optimize PostgreSQL Row Security Policies that involve related tables?

2023-08-14 Thread David Ventimiglia
Sorry, I had a typo in my Row Policy. Rather, it should look like this: create policy album_rls_policy on "Track" for select to public using ( exists (select * from "Album" where "Album"."AlbumId" = "Track"."AlbumId"

Re: Query plan regression between CTE and views

2023-08-15 Thread David Gilman
I'm on PostgreSQL 15 with essentially a stock configuration. On Tue, Aug 15, 2023 at 8:58 AM Ron wrote: > > On 8/14/23 09:54, David Gilman wrote: > > I have a query that was originally written as a handful of CTEs out of > > convenience. It is producing a reasonable que

Re: Partitionwise JOIN scanning all partitions, even unneeded ones

2023-08-30 Thread David Rowley
t, there is some work going on by Richard Guo [1] where he aims to implement this. It is quite a tricky thing to do without causing needless pruning work in cases where no partitions can be pruned. If you have an interest, you can follow the thread there to see the discussion about the difficulties with i

Re: Question on Partition key

2023-09-04 Thread David Rowley
uestioned him about this and as it turned out, some version of Oracle once didn't optimise these very well and when he learned this, he took that knowledge and seemingly applied it to all versions of all RDBMSs in the universe. Rather bizarre, but perhaps that's what's going on here too. David

Re: Query performance going from Oracle to Postgres

2023-09-06 Thread David Rowley
at the column is NOT NULL so can do count(*) instead of counting the non-nulls from that column. That may allow it to Index Only Scan? I'm not versed in reading Oracle plans so don't know if it's possible to tell. David

Re: Query performance going from Oracle to Postgres

2023-09-07 Thread David Rowley
the explain analyze. I think all that's going on is that each tuple is on a different page and the heap accesses are just causing many buffers to be accessed. It seems to me that an IOS would likely fix that problem which is why I suggested count(*) instead of count() David

Re: Is data import from Oracle table to Postgres table in Ora2pg consecutive or random?

2023-09-12 Thread DAVID ROTH
I have not tried this in a while but I think a SELECT with a "hint" will return rows in the order of the index in the hint. This does NOT work for distributed queries. > On 09/12/2023 9:10 AM EDT Daniel Gustafsson wrote: > > > > On 12 Sep 2023, at 14:26, Matthias Apitz wrote: > > > > El

Re: Access plan selection logic PG9.2 -> PG14

2023-09-14 Thread David Rowley
you're using a test instance that's not needed by anyone else). David

Re: Access plan selection logic PG9.2 -> PG14

2023-09-15 Thread David Rowley
ws) analyze tbl; explain analyze select a,b,c,d,h from tbl where a = '10' and b = '10' and c = '10' and d = '10' and e = '10' and h = 1; Index Only Scan using tbl_pkey on tbl (cost=0.55..4.58 rows=1 width=48) (actual time=0.071..0.072 rows=1 loops=1) Index Cond: ((a = '10'::text) AND (b = '10'::text) AND (c = '10'::text) AND (d = '10'::text) AND (e = '10'::text) AND (h = 1)) Heap Fetches: 0 Planning Time: 0.146 ms Execution Time: 0.087 ms (5 rows) David

Re: pg_stat_statements IN problem

2023-10-03 Thread David Rowley
h aims to improve the situation in [1]. Perhaps, if you're in a position to, you could help review that. David [1] https://postgr.es/m/flat/CA%2Bq6zcWtUbT_Sxj0V6HY6EZ89uv5wuG5aefpe_9n0Jr3VwntFg%40mail.gmail.com

Re: pg_stat_statements IN problem

2023-10-03 Thread David Rowley
On Tue, 3 Oct 2023 at 22:03, wrote: > So one last question, should I expect the patch to land in version 17 only or > is there chance that it will also be in lower versions right away? It wouldn't ever be put into anything earlier than 17. David

Proposal to Compile a 256-Byte Identifier Length Version Alongside the Current 64-Byte Version

2023-10-09 Thread David HJ
Hello PostgreSQL Community, I am writing to propose an alternative compilation of PostgreSQL that allows for a 256-byte identifier length limit, alongside the existing 64-byte version. *Problem:* The current limit of 63 bytes can be quite restrictive, especially for databases that use multi-byte

Need efficient way to remove (almost) duplicate rows from a table

2023-10-17 Thread David Gauthier
v11.5 on linux (I know, I know, IT is working on the upgrade to 15.2) I have a table with millions of records and there are a lot of "almost" duplicates that I want to get rid of in an efficient way. Best to illustrate with a simple example... We'll talk about deleting leaves on a tree where eac

Re: partitioning

2023-10-23 Thread David Rowley
oundaries CHECK(not is_sold and purchase_time >= '-infinity' and purchase_time < 'infinity'); David

Help with a good mental model for estimating PostgreSQL throughput

2023-10-30 Thread David Ventimiglia
er of operations that can be performed within 1 second? My initial guess would be ~1, but then perhaps I'm overlooking something. I expect a more reliable figure would be obtained through testing, but I'm looking for an *a priori *back-of-the-envelope estimate. Thanks! Best, David

Re: Help with a good mental model for estimating PostgreSQL throughput

2023-10-30 Thread David Ventimiglia
s per operation * number of connections = 1000 ms / 101 ms * 1000 = ~1 - something else - impossible to determine without more information Best, David On Mon, Oct 30, 2023 at 8:46 AM Laurenz Albe wrote: > On Mon, 2023-10-30 at 08:05 -0700, David Ventimiglia wrote: > > Can s

Re: Inefficient query plan for SELECT ... EXCEPT ...

2023-10-31 Thread David Rowley
n EXCEPT queries, unfortunately. There won't be any bug fixes to improve this. It may, however, be improved in some future version of PostgreSQL. David

Indexing fragments of a column's value ?

2023-11-03 Thread David Gauthier
I'm asking about the possibility of indexing portions of a column's value where the column has a static field format. Example, a char(8) which contains all hex values (basically a hex number that's always 8 chars wide, leading zeros if needed). Someone might want to select all recs where the first

<    1   2   3   4   5   6   7   8   9   10   >