Re: About revoking large number of privileges; And the PUBLIC role.

2022-07-08 Thread Peter J. Holzer
inconvenient if that wasn't possible. Do you have an example on where a grant prevents dropping an object? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Cre

Re: - operator overloading not giving expected result

2022-07-08 Thread Peter J. Holzer
ex: 19).  But in Postgres > the > same query returns result as "19 days". Which PostgreSQL version is this? I get 19 with PostgreSQL 11.16 and 14.0. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@h

Re: postgresql generate ddl returns FK with `()` in it

2022-07-08 Thread Peter J. Holzer
er". (Please include relevant details when you ask a question here - don't expect people to look at a stack overflow question). > How can I fix that `();` issue? Is this documented behavior? My guess is that's a bug in DBeaver. hp --

Re: equivalent thing of mtr in mysql

2022-07-12 Thread Peter J. Holzer
e changes also result in an atomic disk write seems to be both pointless and impossible (that might be many gigabytes of data). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charle

Re: equivalent thing of mtr in mysql

2022-07-12 Thread Peter J. Holzer
On 2022-07-12 13:07:41 -0600, Rob Sargent wrote: > I thought OP was hinting at WAL stuff defn here So did I. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative

Re: Was my question inappropriate for postgres?

2022-07-28 Thread Peter J. Holzer
r to connect to an oracle database that's too old or too new (or you may be able to connect and then get weird errors - BTDT). PostgreSQL is in my experience rather tolerant of client/server mismatches, but I wouldn't be surprised if some stuff wouldn't work if the versions are too diff

Re: Copying records from TABLE_A to TABLE_B (in the same database)

2022-08-02 Thread Peter J. Holzer
r is quite a bit faster that copying into the database (and therefore also copying out AND copying in). hp [1] https://github.com/hjp/dbbench/blob/master/import_pg_comparison/results/akran.2019-12-15/results.png -- _ | Peter J. Holzer| Story must make more sense than re

Re: PostgreSQL 14.4 ERROR: out of memory issues

2022-08-06 Thread Peter J. Holzer
aster, as last time I looked (it's been some time) the optimizer wasn't especially good at handlung DISTINCT FROM (probably because it's so rarely used). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@h

Re: How to choose new master from slaves.?

2022-08-06 Thread Peter J. Holzer
ght. Otherwise: For the same reason I would prefer B, I would prefer the one with the most up-to-date data. But there might be other considerations, e.g. the network connections (bandwidth and delays) between the surviving members and the clients. hp -- _ | Pete

Re: How to choose new master from slaves.?

2022-08-06 Thread Peter J. Holzer
On 2022-08-06 15:06:06 -0500, Ron wrote: > On 8/6/22 03:40, Peter J. Holzer wrote: > > Using sync replication on an unstable link is probably not a good idea. > > Every time the link goes down, A freezes. Is this what you want? > > I had to fight my end users about how to r

Re: index row size 2720 exceeds btree version 4

2022-08-10 Thread Peter J. Holzer
nd an fqdn at most 255 bytes. So without the scan id we are at 285 bytes. maybe a bit more due to overhead. That leaves about 2400 bytes for the scan id. I don't know what a scanid is, but 2000+ bytes for an id seems excessive. hp -- _ | Peter J. Holzer| Story

Re: Can I get the number of results plus the results with a single query?

2022-08-15 Thread Peter J. Holzer
valuated) followed by a very quick count up (while the result is transmitted to the client). Probably not what you want. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Cr

Re: Can I get the number of results plus the results with a single query?

2022-08-16 Thread Peter J. Holzer
seconds, the progress indicator is useless. You are stuffing the whole result into an array and THEN counting the number of elements. So when you get to the count all of the work (except sending the result to the client) is already done, so there is little point in displaying a progress indicator.

Re: Can I get the number of results plus the results with a single query?

2022-08-17 Thread Peter J. Holzer
er clarify that he's fetching a lot of data for each row, so «select count(*) ,,,» is indeed much faster than «select * ...» due to the sheer amount of data to be transferred. That wasn't obvious from his first message, but I hedged against the possibility in my answer.)

Re: With Recursive / Recursive View question

2022-08-21 Thread Peter J. Holzer
ursive query. That's theoretically possible but I would be surprised if it actually did this. (It didn't in my tests, but my test data set was too small to get it to even use indexes with normal queries). hp -- _ | Peter J. Holzer| Story must make more sense

Re: Support for dates before 4713 BC

2022-08-21 Thread Peter J. Holzer
ed int to an int halves the positive range. But it seems that this is already capped at 2**31 days (5874897 AD), so that wouldn't be a problem here. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp

Re: Support for dates before 4713 BC

2022-08-23 Thread Peter J. Holzer
uncertainty of +/- 50 years? I guess to really store "what do I know about when something happened" you would have to be able to store a number of constraints (like "between year x and y", "at least d years after event e", "between month m and n", etc.)

Re: Setting up a server with previous day data

2022-08-23 Thread Peter J. Holzer
ve your problem. Isn't that what logical replication basically does? I also think I've seen other tools parsing the WAL stream and doing something useful with the results. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: How to make PostreSQL utilities honor home directories?

2022-09-01 Thread Peter J. Holzer
. If I run % sudo -u postgres -H /usr/lib/postgresql/13/bin/psql (which is not a symlink) I get the same behaviour. So it seems that psql changes to its basedir and then can't change back again. And sure enough, strace shows: chdir("/usr/lib/postgresql/13/bin") = 0 chdir("/h

Re: Missing query plan for auto_explain.

2022-09-02 Thread Peter J. Holzer
this affects auto_explain. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: How to make PostreSQL utilities honor home directories?

2022-09-02 Thread Peter J. Holzer
PG-USERNAME localusers rootpostgres Then root can invoke `psql -U postgres ...`, but other users can't. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: How to make PostreSQL utilities honor home directories?

2022-09-02 Thread Peter J. Holzer
On 2022-09-01 20:49:56 -0400, Jeffrey Walton wrote: > On Thu, Sep 1, 2022 at 8:23 PM Peter J. Holzer wrote: > > > > On 2022-09-01 18:16:14 -0400, Tom Lane wrote: > > > Jeffrey Walton writes: > > > > We are having a heck of a time getting PostreSQL utilities to

Re: Query Performance

2022-09-17 Thread Peter J. Holzer
eld4`: I have no idea what this is supposed to do, so it's hard to tell if there is a better way. Using `a` to refer to 3 different things doesn't help either. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.a

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-09-27 Thread Peter J. Holzer
efense. The database frequently won't be accessible from the open internet (or even the company network) directly. Only a middle tier of application servers running vetted client code will connect directly. Even those servers may not be accessible directly to end users. There may be a layer of proxy s

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-09-28 Thread Peter J. Holzer
t; users. There may be a layer of proxy servers above them. Each of these > > > layers may implement additional checks, rate limits and monitoring. > > If no one has direct SQL access to the database, then there's no problem with > a > role being able to pg_terminate_backe

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-09-28 Thread Peter J. Holzer
ons ...) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-09-30 Thread Peter J. Holzer
oles by another name" or "just data". hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-10-01 Thread Peter J. Holzer
bout it" abstraction which puts it closer to the "roles by another name" camp. > Platform Multitenant Architecture > https://architect.salesforce.com/fundamentals/platform-multitenant-architecture That's *too* high-level for me. There's any number of techniques which cou

Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Peter J. Holzer
s of course assumes that the behaviour is intentional and not a bug.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Peter J. Holzer
itches to a generic plan if it thinks that the generic plan isn't worse than the specialized plans. If the plan suddenly gets worse after 5 executions, you've probably run into a case where the generic plan is worse although the cost computed by the planner isn't. hp -- _

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Peter J. Holzer
On 2022-10-01 20:24:21 +0800, Julien Rouhaud wrote: > On Sat, Oct 01, 2022 at 02:05:53PM +0200, Peter J. Holzer wrote: > > On 2022-09-30 17:59:01 -0700, Bryn Llewellyn wrote: > > > set rls.tenant_id=42; > > > > This works because there is a "." in the name.

Re: Exponentiation confusion

2022-10-13 Thread Peter J. Holzer
║ ╟──╢ ║ 0.000100 ║ ╚══╝ (1 row) So the number of decimals by default isn't sufficient to represent 10^-18. You have to explicitely increase it. hp -- _ | Peter J. Holzer| Story must

Re: Explain returns different number of rows

2022-10-22 Thread Peter J. Holzer
imate in the first tuple changes without any actual data change (although the only reason I can think of right now would be an ANALYZE (in another session or by autovacuum)). But the actual rows definitely shouldn't change. hp -- _ | Peter J. Holzer

Re: PostgreSql Service different path

2022-10-24 Thread Peter J. Holzer
nd when I check it says  [doesn't use /home/dmartuser/pgsql/14/data] > > How can I point the service to read the new path ( /home/dmartuser/pgsql/14/ > data )?  Check the systemd configuration file for this service. hp -- _ | Peter J. Holzer| Story must

Re: Index corruption revealed after upgrade to 11.17, could date back to at least 11.12

2022-10-27 Thread Peter J. Holzer
initions the same? (Just trying to rule other other possible error sources.) > I do apologize, but I do not understand the value of doing that select > juggling. I think Allan may have misread your mail. hp -- _ | Peter J. Holzer| Story must make more sens

Re: Index corruption revealed after upgrade to 11.17, could date back to at least 11.12

2022-10-27 Thread Peter J. Holzer
On 2022-10-27 15:07:06 +0300, Kristjan Mustkivi wrote: > On Thu, Oct 27, 2022 at 12:18 PM Peter J. Holzer wrote: > > On 2022-10-27 10:55:31 +0300, Kristjan Mustkivi wrote: > > > We use dockerized postgres. > > > > So that means you aren't just replaci

Re: Index corruption revealed after upgrade to 11.17, could date back to at least 11.12

2022-10-28 Thread Peter J. Holzer
t at that time or does it just issue a notice and continue to rebuild the other indexes? In the latter case it migh be easy to miss a problem. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |--

Re: access method xxx does not exist

2022-10-29 Thread Peter J. Holzer
dex, but why would you?) > I do like this. I add oid in pg_am.dat and pg_proc.dat for my index. > And I add codes in contrib and backend/access/myindex_name, is there > any other places I need to add some infos? What? Why are you doing these things? hp -- _ | Peter J. Ho

Re: "peer" authentication: cannot make "pg_ident.conf" work as I believe that the doc says that it should

2022-10-30 Thread Peter J. Holzer
/s user is > logging > in using their own name as the requested login role. I think that's not quite correct. The -U option affects which user name psql uses to connect to the server. It is psql which defaults to the OS user name in the absence of the -U option (or the PGUSER environment

Re: "peer" authentication: cannot make "pg_ident.conf" work as I believe that the doc says that it should

2022-10-30 Thread Peter J. Holzer
arted: "su mary". > > 2. Then I want to start a session (I use "psql" here an an example) like > this: > "psql -d postgres". > > 3. Then, at the "psql" prompt, I want "select session_user" to show "bob". Set the PGUSER=

Re: "peer" authentication: cannot make "pg_ident.conf" work as I believe that the doc says that it should

2022-10-30 Thread Peter J. Holzer
AICS your test users aren't supposed to be that. > uid=1001(postgres) gid=1001(postgres) groups=1001(postgres),27(sudo),114 > (ssl-cert) And is there a reason for posgres to be in group sudo? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: CASE CLOSED... Re: "peer" authentication: cannot make "pg_ident.conf" work as I believe that the doc says that it should

2022-10-31 Thread Peter J. Holzer
nant:~ 22:46 :-) 1016# su - 'mac$crooge' mac@trintignant:~$ id uid=1002(mac$crooge) gid=1003(mac$crooge) groups=1003(mac$crooge) mac@trintignant:~$ I'm not saying that doing this is a good idea ... hp -- _ | Peter J. Holzer| Sto

Re: Delete a table automatic?

2022-11-01 Thread Peter J. Holzer
t; select * from b; ╔╤═══╤══╗ ║ id │ a │ t ║ ╟┼───┼──╢ ║ 1 │ 1 │ foo1 ║ ║ 2 │ 1 │ foo2 ║ ║ 3 │ 2 │ bar1 ║ ╚╧═══╧══╝ (3 rows) And the data in the table is also unchanged. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: SSL/TLS encryption without

2022-11-01 Thread Peter J. Holzer
nd even those that do need only one key, so it is sufficient that only the server has a certificate. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | h

Re: Putting the O/S user for "local" "peer" authentication in the "postgres" group vs chmod'ing the "pg*.conf" files to be readable by "all"

2022-11-03 Thread Peter J. Holzer
sudo vi /etc/postgresql/14/main/pg_hba.conf > [sudo] password for aklaver: > > which opens pg_hba.conf for editing. Well, yes. Root can edit the file, too. But root can edit anything[1]. hp [1] Except ... lots of stuff, actually. -- _ | Peter J.

Re: copy file from a client app to remote postgres isntance

2022-11-09 Thread Peter J. Holzer
s the latter, your programming language's postgresql library probably has a method for invoking copy. > Has anything changed in the last ten years? Or, is there a > better way to copy file contents in a remote database? COPY is the fastest way to load data. hp -- _

Re: copy file from a client app to remote postgres isntance

2022-11-09 Thread Peter J. Holzer
you use copy_from() you don't have to parse it (but then why use Python at all?) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: copy file from a client app to remote postgres isntance

2022-11-09 Thread Peter J. Holzer
On 2022-11-09 12:57:23 -0600, Ron wrote: > On 11/9/22 10:17, Peter J. Holzer wrote: > > On 2022-11-07 14:40:40 -0600, Ron wrote: > > > On 11/7/22 10:57, Вадим Самохин wrote: > > > I have an application that must copy a local file in csv format to a > > >

Re: Table : Bloat grow high

2022-11-12 Thread Peter J. Holzer
pdates, so again some may be HOT updated and some not. If you are updating the same tupel several times, you may get a few HOT updates first, then a non-HOT update, then HOT updates again. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?

2022-11-18 Thread Peter J. Holzer
an appropriately configured role with > "nosuperuser". One important task that can AFAIK only be performed by superusers is the creation of functions in untrusted languages like plpython3u and plperlu. If your application uses functions in those languages you ne

Lots of read activity on index only scan

2022-11-18 Thread Peter J. Holzer
h sounds reasonable) while the other reads 9995216 buffers (or almost one full buffer per row). Why? The entries should be dense in the index in both cases and since it's an index only scan (and explain says there were 0 heap fetches) I would not expect extra accesses. Where do these buffer reads

Re: Lots of read activity on index only scan

2022-11-18 Thread Peter J. Holzer
On 2022-11-18 15:59:46 -0500, Tom Lane wrote: > "Peter J. Holzer" writes: > > Both do a parallel index only scan. Both perform 0 heap fetches. > > But one reads 27336 buffers (or about 22 bytes per index entry, which > > sounds reasonable) while the other reads

Re: Lots of read activity on index only scan

2022-11-18 Thread Peter J. Holzer
On 2022-11-18 13:09:16 -0800, Peter Geoghegan wrote: > On Fri, Nov 18, 2022 at 12:46 PM Peter J. Holzer wrote: > > Both do a parallel index only scan. Both perform 0 heap fetches. > > But one reads 27336 buffers (or about 22 bytes per index entry, which > > sounds reason

Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?

2022-11-18 Thread Peter J. Holzer
t editing errors happen and are not always caught by a reviewer. Having to get the database, the role and the password consistently wrong is a much greater hurdle that getting just the database wrong. So you can give these credentials to you developers or devops folks (whom you trus

Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?

2022-11-19 Thread Peter J. Holzer
On 2022-11-18 16:21:18 -0600, Ron wrote: > On 11/18/22 16:13, Peter J. Holzer wrote: > > So you can give these credentials to you developers or devops folks > > (whom you trust not attack the system - > > They like to "fix" things without documenting what they

Re: copying json data and backslashes

2022-11-22 Thread Peter J. Holzer
╔═══╗ ║ ascii ║ ╟───╢ ║ 3 ║ ╚═══╝ (1 row) Same for the other ctrl characters. hp [1] There are usually four Ctrl-Characters which need only a single key: Ctrl-I (TAB), Ctrl-M (CR), Ctrl-[ (ESC) and Ctrl-H (BS) or Ctrl-? (DEL). (On Unix systems CR is

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-02 Thread Peter J. Holzer
red by the server. So you can't simply tell whether the stored/used version corresponds to the code you installed. I don't know how reproducable that tokenization process is. Can you just do it again and compere the results? hp -- _ | Peter J. Holzer| Stor

Re: Regular expression for lower case to upper case.

2022-12-10 Thread Peter J. Holzer
are not what I want. Can you elaborate why you can't use those? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ |

Re: Regular expression to UPPER() a lower case string

2022-12-10 Thread Peter J. Holzer
that a reason why it should). > * your logic only works by accident for some languages (try to upcase > a `ß` or a `ı`) This is also true of upper() and lower() and SQL does provide those. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: Regular expression for lower case to upper case.

2022-12-10 Thread Peter J. Holzer
(x, '(.*_)(.*)(_.*)', '\2')) || regexp_replace(x, '(.*_)(.*)(_.*)', '\3') FROM test; ╔═╗ ║ ?column? ║ ╟─╢ ║ abc_DEF_ghi ║ ╚═╝ (1 row) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Regular expression to UPPER() a lower case string

2022-12-10 Thread Peter J. Holzer
On 2022-12-10 13:44:37 +, Gianni Ceccarelli wrote: > On 2022-12-10 "Peter J. Holzer" wrote: > > > * your logic only works by accident for some languages (try to > > > upcase a `ß` or a `ı`) > > > > This is also true of upper() and lo

Re: Regular expression to UPPER() a lower case string

2022-12-10 Thread Peter J. Holzer
. but that would be insane even for the 26 letters of the basic Latin alphabet, much less the myriad of accented letters (and other alphabets like Cyrillic or Greek ...). On second thought you could probably use NFD normalization to separate base letters from accents, uppercase the base letters an

Re: Regular expression to UPPER() a lower case string

2022-12-10 Thread Peter J. Holzer
'(.)(.)(.)', '\2')) || UPPER(REGEXP_REPLACE(x, '(.)(.)(.)', '\3')) FROM test; ╔═╤═╗ ║ x │ ?column? ║ ╟─┼─╢ ║ abc_def_ghi │ A_DEF_GHIB_DEF_GHIC_DEF_GHI ║ ╚══

Re: Regular expression to UPPER() a lower case string

2022-12-11 Thread Peter J. Holzer
On 2022-12-10 15:48:58 +0100, Peter J. Holzer wrote: > On second thought you could probably use NFD normalization to separate > base letters from accents, uppercase the base letters and then > (optionally) NFC normalize everything again. Of course I had to try that: wds=> select

Re: Regd. the Implementation of Wallet (in Oracle) config equivalent in postgreSQL whilst the database migration

2022-12-22 Thread Peter J. Holzer
e not on the same box. They are in a HSM. A dedicated piece of > tamper-proof hardware that stores secrets (keys). > The Oracle-server needs to talk to the HSM to get the keys. If the hacker has root access: What prevents them from talking to the HSM? hp -- _ | Peter J. Holze

Re: Regd. the Implementation of Wallet (in Oracle) config equivalent in postgreSQL whilst the database migration

2022-12-22 Thread Peter J. Holzer
On 2022-12-22 11:15:57 +0100, Rainer Duffner wrote: > > > Am 22.12.2022 um 10:46 schrieb Peter J. Holzer : > > If the hacker has root access: What prevents them from talking to the > HSM? > > > > I wasn’t involved in setting it up here, but AFAIK you

Re: best practice to patch a postgresql version?

2022-12-27 Thread Peter J. Holzer
with multiple active nodes running already. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: REINDEX vs VACUUM

2023-01-05 Thread Peter J. Holzer
living room. Isn't that how you normally vacuum your living room? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ |

Re: REINDEX vs VACUUM

2023-01-05 Thread Peter J. Holzer
On 2023-01-05 12:34:08 +0100, Karsten Hilbert wrote: > > Von: "Peter J. Holzer" > > On 2023-01-04 09:34:42 -0600, Ron wrote: > > > I don't think VACUUM FULL (copy the table, create new indices and other > > > metadata all in one command) actually

Re: Purging few months old data and vacuuming in production

2023-01-07 Thread Peter J. Holzer
rate. I'd go for a middle ground: Instead of expiring once per day, use a shorter interval, maybe once per hour or once per minute. That will (probably) make each expire job really quick but still create much less load overall. hp -- _ | Peter J. Holzer| Story must make m

Re: Purging few months old data and vacuuming in production

2023-01-07 Thread Peter J. Holzer
On 2023-01-07 07:40:01 -0600, Ron wrote: > On 1/7/23 05:29, Peter J. Holzer wrote: > If I understood correctly, you have to delete about 3 million records > (worst case) from the main table each day. Including the other 8 tables > those are 27 million DELETE queries e

Re: Intervals and ISO 8601 duration

2023-01-13 Thread Peter J. Holzer
g like this to PostgreSQL would be worthwhile? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Dump (was: Intervals and ISO 8601 duration)

2023-01-13 Thread Peter J. Holzer
On 2023-01-14 06:32:03 +0100, Peter J. Holzer wrote: > Oracle has a function which returns the internal representation of a > value as a series of (decimal) byte values. Back in the days when I was > new to Oracle I used this to figure out how Oracle stores NUMBER, but > now I'

Re: does refreshing materialized view make the database bloat?

2023-01-14 Thread Peter J. Holzer
eted[1]. Whether that means that the space is "immediately" available again is up to the operating system. hp [1] Possibly delayed until commit. -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: timestamptz, local time in the future, and Don't do it wiki

2023-01-27 Thread Peter J. Holzer
ocal time + time zone, not timestamptz (the time zone can be implicit). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Sequence vs UUID

2023-02-02 Thread Peter J. Holzer
On 2023-02-02 10:22:09 -0500, Benedict Holland wrote: > Well... until two processes generate an identical UUID. That happened to me > several times. How did that happen? Pure software implementation with non-random seed? Hardware with insufficient entropy source? hp -- _ | P

Re: Question regarding UTF-8 data and "C" collation on definition of field of table

2023-02-06 Thread Peter J. Holzer
On 2023-02-05 18:57:13 -0600, Ron wrote: > Why are you specifying the collation to be "C" when the default db encoding > is UTF8, and UTF-8 has Greek, Chinese and English encodings? C is equally bad for Greek, Chinese and English ;-) hp -- _ | Peter J. Holzer|

Re: Sequence vs UUID

2023-02-06 Thread Peter J. Holzer
e may be negligible or huge. It really depends on your access patterns. hp [1] There was even a discussion about making that much faster on the LKML recently. -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.a

Re: PostgreSQL

2023-02-07 Thread Peter J. Holzer
les, schemas and databases and covered by the "usual" SQL privilege system. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http:

Re: Sequence vs UUID

2023-02-08 Thread Peter J. Holzer
so during migrations, restores from backups and other infrequent events. With random Ids you don't have to worry about this. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Str

Re: WHERE col = ANY($1) extended to 2 or more columns?

2023-02-11 Thread Peter J. Holzer
══════════╝ (10 rows) The latter is almost 1000 times faster. Saving 1.8 ms on planning time doesn't help you if you the

Re: WHERE col = ANY($1) extended to 2 or more columns?

2023-02-11 Thread Peter J. Holzer
On 2023-02-11 16:21:49 +0100, Peter J. Holzer wrote: > On 2023-02-09 18:35:42 +0100, Dominique Devienne wrote: > > Right. The goal is to (re)use a prepared statement (i.e. plan once), and > > bind > > the RHS (binary) array > > and do a single exec (single round-tri

Re: Query plan for "id IS NULL" on PK

2023-02-14 Thread Peter J. Holzer
nd should be fixed. OTOH it could also be argued that the optimizer should be able to perform the same simplifications as I did above and produce the same code for WHERE (("id" > ? OR "id" IS NULL)) AND (("id" <= ?)) as for WHERE (("id" > ?))

Re: Query plan for "id IS NULL" on PK

2023-02-14 Thread Peter J. Holzer
On 2023-02-14 15:36:32 -0700, Rob Sargent wrote: > But if the query is supposed to be generic and re-used in a situation where id > could be null, wouldn't the null id records be fetched every time?  No, they will never be fetched because of the AND (("id" <= ?)).

Re: Does Postgres 14 have a query cache?

2023-02-18 Thread Peter J. Holzer
e case (the exact same query is submitted repeatedly) is sufficiently rare that it isn't all that effective in practice. (The other techniques mentioned are of course also used by other databases.) hp -- _ | Peter J. Holzer| Story must make m

Re: Quit currently running query

2023-02-28 Thread Peter J. Holzer
n be a DNS or LDAP client). (And some programs are even server and client for the same protocol) 3) A machine intended for running server programs. You are thinking of the 3rd meaning. My guess is that Albert meant the first. hp -- _ | Peter J. Holzer| Story must make

Re: Dropping behavior for unique CONSTRAINTs

2023-03-04 Thread Peter J. Holzer
That doesn't work. A unique constraint can't exist without a (unique) index. Think about it: With a unique constraint PostgreSQL needs to check for every insert whether the value already exists in the table. Without an index this would mean a full table scan. hp -- _ | Peter

Re: Dropping behavior for unique CONSTRAINTs

2023-03-04 Thread Peter J. Holzer
n is pointing out that CONCURRENTLY cannot be used for that purpose. (I realize that your idea is not to create the constraint in the first place.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Dropping behavior for unique CONSTRAINTs

2023-03-04 Thread Peter J. Holzer
On 2023-03-04 02:34:02 -0600, Ron wrote: > On 3/4/23 02:03, Peter J. Holzer wrote: > [snip] > > So your plan is to create a unique constraint (backed by a unique > > index) and then to drop the index and keep the constraint? > > > > That doesn't work. A uniq

Re: escape vs. bytea in config

2023-03-07 Thread Peter J. Holzer
oubles backslashes. Other | byte values are represented literally. So the byte 0x19 is converted to a single character U+0019 (EM) which is then displayed as '\x19', while bytes >= 0x80 are converted to four-character escape sequences. hp -- _ | Peter J. Holzer

Re: Properly handle OOM death?

2023-03-13 Thread Peter J. Holzer
roblems anyway, so it is questionable if one wants to enable external > # automatic restarts. > #Restart=on-failure So I'd try this despite the comment. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@h

Re: Properly handle OOM death?

2023-03-13 Thread Peter J. Holzer
On 2023-03-13 09:55:50 -0800, Israel Brewster wrote: > On Mar 13, 2023, at 9:43 AM, Peter J. Holzer wrote: > > On 2023-03-13 09:21:18 -0800, Israel Brewster wrote: > >> I’m running a postgresql 13 database on an Ubuntu 20.04 VM that is a bit > >> more > >>

Re: Uppercase version of ß desired

2023-03-13 Thread Peter J. Holzer
an alternate locale: hjp=> select upper('ß'); ╔═══╗ ║ upper ║ ╟───╢ ║ ß ║ ╚═══╝ (1 row) hjp=> select upper('ß' collate "de-AT-x-icu"); ╔═══╗ ║ upper ║ ╟───╢ ║ SS ║ ╚═══╝ (1 row) The challenge now is to find a

Re: Issues Scaling Postgres Concurrency

2023-03-14 Thread Peter J. Holzer
Or possibly counting stuff far more often than necessary. If an exact count is necessary more frequently than it changes it is probably a good idea to store that somewhere and update it in a trigger. (If the count doesn't have to be totally up-to-date, caching it in the

Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?

2023-03-17 Thread Peter J. Holzer
OPY some time.) With COPYing the output of a SELECT I don't see any savings. On the contrary, it's an extra step. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles S

Re: EXTERNAL: Re: "No Free extents", table using all allocated space but no rows!

2023-03-17 Thread Peter J. Holzer
wards. The BSD file system and its descendants (like ext4) don't like getting completely full.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Patroni, slots, and expiring WALs

2023-03-28 Thread Peter J. Holzer
se do I have to configure? (I know about wal_keep_size, but it was my understanding that this isn't needed when slots are used) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stros

Re: Cluster table based on grand parent?

2023-03-28 Thread Peter J. Holzer
hild(id) on delete cascade, grandparent int not null references parent(id) on delete cascade, name text not null, unique(grandparent, parent, name) ); hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Patroni, slots, and expiring WALs

2023-03-28 Thread Peter J. Holzer
On 2023-03-28 11:07:04 -0400, Jeremy Smith wrote: > On Tue, Mar 28, 2023 at 10:55 AM Peter J. Holzer wrote: > > The configuration includes `use_slots: true` and I can see a slot in > pg_replication_slots on the leader. > > I was under the impression that this woul

Re: Patroni, slots, and expiring WALs

2023-03-28 Thread Peter J. Holzer
On 2023-03-28 17:08:38 +0200, Alexander Kukushkin wrote: > On Tue, 28 Mar 2023 at 16:55, Peter J. Holzer wrote: > > > However, when we took down one node for about two hours for some tests > recently (with some moderate traffic on the remaining node), the replica >

<    1   2   3   4   5   6   7   >