Re: [GENERAL] Postgres not using GiST index in a lateral join

2015-03-04 Thread Alban Hertroys
t Relationship": > > "SubPlan", "Subplan Name": "SubPlan 1", "Startup Cost": 0.00, "Total Cost": > > 4.68, "Plan Rows": 1, "Plan Width": 8, "Plans": [ { "Node Type": "Seq Scan", > &

Re: [GENERAL] Update using non-existent fields does not throw an error

2015-03-16 Thread Alban Hertroys
On 16 March 2015 at 17:02, Rob Richardson wrote: > Greetings! > > > > An update query is apparently succeeding, even though the query refers to > fields that do not exist. Here’s the query: > > > > update inventory set > > x_coordinate = (select x_coordinate from bases where base = '101'), > > y_

Re: [GENERAL] Reg: PL/pgSQL commit and rollback

2015-03-17 Thread Alban Hertroys
On 17 March 2015 at 15:30, Medhavi Mahansaria wrote: > Yes. I have read this document. > > But my issue is that even when it throws and exception I need to rollback > the changes made by that query and move on to the next block. > > Is there any way to accomplish that? Please do not toppost on th

Re: [GENERAL] Installation Size showing huge size in postgres installed on windows os

2015-03-19 Thread Alban Hertroys
On 19 March 2015 at 13:44, Raymond O'Donnell wrote: > On 19/03/2015 12:39, jaime soler wrote: >> El mié, 18-03-2015 a las 23:05 -0700, Rajagopal NS escribió: >>> I have installed Postgres 9.0 in my machine. When I look at Programs and >>> Features under Control Panel, >>> I see the Size for Postgr

Re: [GENERAL] Populating missing dates in postgresql data

2015-03-26 Thread Alban Hertroys
No > > > > I need to do a count of comm failures by day, so I need to populate the > check-in date field. Please help! Easiest would be to insert the missing values in your table, something like: WITH RECURSIVE calendar (missing_date) AS ( SELECT MAX(check_

Re: [GENERAL] pgadmin3 installation on Oracle Linux 6.6 64-bit ?

2015-03-30 Thread Alban Hertroys
On 28 March 2015 at 02:14, Yuri Budilov wrote: > I am new to PostgreSQL and Linux (coming across from Microsoft SQL Server). > > I installed PostgreSQL 9.4 on Oracle Linux 6.6 and its working ok (psql, > etc). > Now I try to install pgadmin3 on the same OS. > > I am having problems installing pda

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-03 Thread Alban Hertroys
On 2 April 2015 at 19:15, Taylor Brown wrote: > So, I would rather put a check like this at the top of my function: > > -- > important_variable = (p_request::json->>'important_variable')::integer; > IF (important_variable is NULL) THEN RAISE EXCEPTION 'important_variable > must not be NULL.'; END

Re: [GENERAL] schema or database

2015-04-13 Thread Alban Hertroys
to do some kind of query involving multiple customers. That's easier to backup, sure, but you can't restore a single customer's schema easily that way. So if one customer messes up their data big time, you'll need to restore a backup for all customers in the DB. Alban Hertro

Re: [GENERAL] plpgsql functions organisation

2015-05-03 Thread Alban Hertroys
; > The beauty of PostgreSQL is that you have both available and you > can choose whichever is best for your situation. > > Agreed, though in my case I drop into plpythonu when I want more complex > solutions. > > > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > > > -- > Melvin Davidson > I reserve the right to fantasize. Whether or not you > wish to share my fantasy is entirely up to you. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Allowing postgresql to accept 0xff syntax for data types that it makes sense for?

2015-05-22 Thread Alban Hertroys
On 22 May 2015 at 04:46, Bill Moran wrote: > I did a litle research and it appears that neither Oracle nor db2 supports > the 0xff syntax ... so not _quite_ as common as it seemed to me. > With all that being said, if I were to build a patch, would it be likely > to be accepted into core? Wouldn

Re: [GENERAL] date with month and year

2015-05-22 Thread Alban Hertroys
On 21 May 2015 at 23:42, Karsten Hilbert wrote: > You are right in the following aspect: > > - client sends in "NOW at HERE" > - server knows HERE = UTC+2 And then the tectonic plate you're on shifts and you're suddenly in UTC+1 or +3 Thankfully, those things don't shift as fast as they sometim

Re: [GENERAL] Python 3.2 XP64 and Numpy...

2015-05-28 Thread Alban Hertroys
^ It looks like you're trying to use 64-bit binaries on a 32-bit OS. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] use null or 0 in foreign key column, to mean "no value"?

2015-06-27 Thread Alban Hertroys
eed to with _named_ query parameters, if those are available to you. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] database-level lockdown

2015-07-07 Thread Alban Hertroys
On 7 July 2015 at 12:55, Filipe Pina wrote: > On Ter, Jul 7, 2015 at 1:41 , Adrian Klaver > wrote: >> Still not sure what is you are trying to accomplish. Is it really necessary >> that every transaction be serialized? Or to put it another way, why are you >> running in serializable by default? O

Re: [GENERAL] Question about copy from with timestamp format

2015-07-30 Thread Alban Hertroys
view in the COPY statement instead of the table. Added bonus, you can now also use the view to export your table to the same CSV format. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Question about copy from with timestamp format

2015-07-30 Thread Alban Hertroys
OPY (SELECT * FROM viewname) TO " > > > Still curious why the triggers I'm writing won't fire before my > statement errors out on copying to a view, or inserting an out-of-range > timestamp, when the trigger would resolve all the illegal operations if > it jus

Re: [GENERAL] Prepared Statements and Pooling

2015-08-11 Thread Alban Hertroys
On 11 August 2015 at 06:44, Mister Junk wrote: > I'm using prepared statements to prevent SQL injection, but I have done some > reading and it seems like using Prepared statements COULD improve > performance. I understand the concept, but I do not know how to implement > this. They could, they c

Re: [GENERAL] to pg

2015-09-25 Thread Alban Hertroys
On 25 September 2015 at 13:08, Ramesh T wrote: > CREATE UNIQUE INDEX idx_load_pick ON pick (case picked when picked='y' then > load_id else null end ); > > how can i convert case expressed to postgres..above it is oracle. Assuming that your queries are written in such a way that Oracle is indeed

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread Alban Hertroys
et in the right mindset. PS. I usually write my hierarchical queries in Oracle, which isn't quite as good at them as Postgres is, but it's what we have @work. Hence, I'm not sure I got the syntax 100% correct. We're working on getting PG in for a project upgrade (replacing RDB

Re: [GENERAL] ftell mismatch with expected position

2015-11-02 Thread Alban Hertroys
Please refrain from top-posting. On 2 November 2015 at 10:48, Eelke Klein wrote: > Normally we call this from within our windows program where a lot of code is > involved for setting up the environment, and creating the pipes and > redirecting stdout, stderr and stdin. However I believe it is the

Re: [GENERAL] Sequences, txids, and serial order of transactions

2016-06-12 Thread Alban Hertroys
As I understand it, sequences have to be non-transactional to be able to guarantee correct ordering. Calling nextval() will increment the sequence, but does not relate it to the transaction at that point. The select statement that does the call to nextval() receives the value from the sequence a

Re: [GENERAL] Help needed structuring Postgresql correlation query

2016-06-21 Thread Alban Hertroys
hat looks something like this for sample size 4: sample 1: (A + B + C + D) sample 2: (A + B + C + D) + E - A = (B + C + D + E) sample 3: (B + C + D + E) + F - B = (C + D + E + F) etc. To accomplish this, you calculate two cumulative totals (often misnamed as running totals, but AFAIK that's so

[GENERAL] Re: [GENERAL] RE: [GENERAL] Re: [GENERAL] A simple extension immitating pg_notify‏

2016-07-26 Thread Alban Hertroys
le PG servers in separate directories, running on separate port numbers, you would have multiple clusters. Same if you distribute those servers over several hosts, what you seem to think a cluster means. That is the difference between a cluster of databases and a cluster of servers. Alban Hertroy

Re: [GENERAL] select array_remove(ARRAY[NULL,NULL,NULL],NULL); returns {} instead of {NULL,NULL,NULL}

2016-08-08 Thread Alban Hertroys
s? Shouldn't the result be: {NULL,NULL,NULL}? (Sorry for sort-of hijacking this thread) Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make ch

Re: [GENERAL] How to retrieve jsonb column through JDBC

2016-08-29 Thread Alban Hertroys
oad.eclipse.org/jetty/9.3.11.v20160721/apidocs/org/eclipse/jetty/util/ajax/JSON.html#parse-java.lang.String- > > fails with: > > java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to > java.util.List I'm not 100% sure it's the root of the ClassCastException h

Re: [GENERAL] psql 9.3 automatic recovery in progress

2016-10-10 Thread Alban Hertroys
e best way to go about this, and best of all, you can combine that with your select statement. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] psql 9.3 automatic recovery in progress

2016-10-10 Thread Alban Hertroys
> On 10 Oct 2016, at 21:28, Alban Hertroys wrote: > > >> On 10 Oct 2016, at 21:12, Periko Support wrote: >> >>for pid in idle_record: >>try: >> #print "process details",pid >> #os.system("ki

Re: [GENERAL] psql 9.3 automatic recovery in progress

2016-10-10 Thread Alban Hertroys
t? Did you contact them about this behaviour yet? Might just be that they're familiar with the problem and have a solution for it. I suspect the Python script you're running was implemented as a rather rough workaround by people from allianzgrp who knew just enough to be harmful. (Kill -9

Re: [GENERAL] update records to have occurance number

2016-10-25 Thread Alban Hertroys
ert into person (fname, lname) values ('next', 'other'); > > How would I issue an update statement to update the number column? That depends on which order you want the database to perceive those rows in. The above example suggests that alphabetical order on fname might wor

Re: [GENERAL] WHERE ... IN condition and multiple columns in subquery

2016-10-28 Thread Alban Hertroys
On 28 October 2016 at 13:03, Alexander Farber wrote: > Hello, > > is it please possible to rewrite the SQL query > > SELECT DISTINCT ON (uid) > uid, > female, > given, > photo, > place > FROM words_social > WHERE uid I

Re: [GENERAL] Rows are repeating by the trigger function

2016-10-30 Thread Alban Hertroys
mns into account and delete rows that belong to the OLD link and not to the NEW one (or do nothing if those stayed the same) - or you do nothing (no trigger needed) because in the majority of cases changing FK's is limited to a few power users at best and they're supposed to know what

Re: [GENERAL] Way to quickly detect if database tables/columns/etc. were modified?

2016-10-30 Thread Alban Hertroys
the commit hook of your VC of choice. Regards, Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Rows are repeating by the trigger function

2016-10-31 Thread Alban Hertroys
On 31 October 2016 at 14:41, Adrian Klaver wrote: > On 10/31/2016 02:06 AM, Kiran wrote: >> I know 94 = 1 + (3 * 31). >> I am just having a normal insert statement into cf_question table. > > Are there any other triggers on the tables? I'm fairly confident that the duplicates are from updates on

Re: [GENERAL] initdb createuser commands

2016-10-31 Thread Alban Hertroys
On 31 October 2016 at 15:50, Christofer C. Bell wrote: > > I think the OP's point is that having a hodgepodge of (on their face) > unrelated commands smells kinda unorganized at best and unprofessional at > worst. Wether or not he's right is up to the reader. For me, I agree with > his sentimen

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-11-04 Thread Alban Hertroys
On 4 November 2016 at 14:41, Merlin Moncure wrote: > On Fri, Nov 4, 2016 at 8:08 AM, Kim Rose Carlsen wrote: >> The nulls are generated by something like this >> SELECT c.circuit_id, >>cc.customer_id >>FROM circuit AS c >> LEFT JOIN circuit_customer AS cc >>

Re: [GENERAL] Recover from corrupted database due to failing disk

2016-11-04 Thread Alban Hertroys
On 4 November 2016 at 11:20, Gionatan Danti wrote: > Unfortuntaly I am working with incredible constrains from customer side; > even buying two SAS disks seems a problem. Moreover, as an external > consultant, I have basically no decision/buying power :| > What I can do (and I did) is to raise a v

Re: [GENERAL] Upgrade from 9.5.4 to 9.6.1

2016-11-16 Thread Alban Hertroys
On 16 November 2016 at 16:33, Rich Shepard wrote: > On Tue, 15 Nov 2016, Rich Shepard wrote: > If 9.6.1 is currently running after running initdb, and I can access my > databases, what does pg_upgrade do that's necessary? pg_upgrade migrates your databases from your old (9.5) cluster to the ne

Re: [GENERAL] huge table occupation after updates

2016-12-10 Thread Alban Hertroys
tainly possible. > > Francisco Olarte. > > ​Hi, ​I think you're right. I was surprised by the huge size of the tables in > my tests but I had not considered the vacuum properly. > My test had a really huge activity so perhaps the autovacuum didn't have time > to make

Re: [GENERAL] Is there a way to Send attachments with email using pgmail postgreSQl?

2016-12-19 Thread Alban Hertroys
re in, say TCL, should be able to handle that. Or am I missing something? Whether it's a good idea to let the database encode attachments and send e-mails is a different matter, but if it isn't doing much beside that - well, why not? Alban Hertroys -- If you can't see the forest

Re: [GENERAL]

2016-12-21 Thread Alban Hertroys
On 21 December 2016 at 09:59, Yogesh Sharma wrote: > Also, every hour,i am performing VACUUM and REINDEX operation on table. Why are you running REINDEX every hour? That's a very unusual thing to do, you'd need a pretty good reason for that. -- If you can't see the forest for the trees, Cut the

Re: [GENERAL]

2016-12-21 Thread Alban Hertroys
Is it possible? I have no idea what you're saying. > On Wednesday, December 21, 2016, Alban Hertroys wrote: >> >> On 21 December 2016 at 09:59, Yogesh Sharma wrote: >> > Also, every hour,i am performing VACUUM and REINDEX operation on table. >> >> Why

Re: [GENERAL] LYDB: What advice about stored procedures and other server side code?

2016-12-27 Thread Alban Hertroys
f MVC. That's just something that struck me to make more than a bit of sense… Of course, for the actual view in the MVC paradigm there should be some kind of user interface, but database views could be really useful in preparing the data required for those, to make it fit the shape of the vi

Re: [GENERAL] LYDB: Feasible to use PG roles instead of application-level security?

2016-12-30 Thread Alban Hertroys
close the connection, create a new one or change the user's role, this procedure doesn't need calling again. > Is this practical? Has anyone here done it? What might the caveats be? It's a fairly common practice, the ML archives should contain plenty of examples. Alban Hertroys

Re: [GENERAL] Special index for "like"-based query

2016-12-30 Thread Alban Hertroys
amp <@ '[2016-12-27 00:00:00, 2016-12-31 00:00:00)'::tsrange The above isn't entirely correct, as tsrange uses timestamp without time zone, but you get the gist. However, if those time ranges can have other values than '[00:00. 23:59]', then you probably need 2 indexe

Re: [GENERAL] Postgres 9.6.1 big slowdown by upgrading 8.4.22

2017-01-06 Thread Alban Hertroys
wdown" for a query that goes from 1.5ms to 4ms? What is the actual problem you're trying to solve? Because I don't see one in the above. Just saying, you're obviously worried about something, but should you be? Alban Hertroys -- If you can't see the forest for the trees, cu

Re: [GENERAL] Postgres 9.6.1 big slowdown by upgrading 8.4.22

2017-01-07 Thread Alban Hertroys
a. Unless you have indexes on those fields in which they are cast to time AND the query planner chooses to use those indexes, the type-cast will get applied to every candidate record each. If you have a million candidate records, that's 2x a million casts taking place (for two fields). To say m

Re: [GENERAL] Why is table not found?

2017-01-31 Thread Alban Hertroys
o is to remove them from your create statements. Most of the time there is no benefit creating case-sensitive identifiers in a database. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] (solved) R: Very strange problem on index

2017-02-02 Thread Alban Hertroys
On 2 February 2017 at 14:57, Job wrote: > Hi Raymond, > > Thank nyou for your appreciated feedback. But what's your answer to his question? You still didn't tell. > Here is the original message: > > i really strange problem, quite near to paranormal, is occurring during a > server migration. >

Re: [GENERAL] using a postgres table as a multi-writer multi-updater queue

2015-12-01 Thread Alban Hertroys
> Before I start in to implement a DELETE / AUTOVACUUM / VACUUM approach, to > recycling disk space used for a session management table, I would like to > propose, for consideration by this forum, an idea for a different approach. > > A row in a session management table, represents a significant "s

Re: [GENERAL] Transfer db from one port to another

2015-12-23 Thread Alban Hertroys
a "pg_dump" to execute Aren't you trying to move a database to PG 9.4? Then you need to use the pg_dump and pg_restore utilities of the 9.4 installation, not those of the 9.3 one. Those utilities are guaranteed to be backwards compatible, but they're not necessarily forwards

Re: [GENERAL] Recurring and non recurring events.

2015-12-27 Thread Alban Hertroys
_stamp from dateRange; I suspect generate_series is faster, but since your query already almost looked like this I thought I'd offer this alternative approach. It has a little bit more flexibility too, as you can add fields and calculations to the CTE quite easily. Alban Hertroys

Re: [GENERAL] to_timestamp alternatives

2016-01-01 Thread Alban Hertroys
e not all time zones are full hours apart, or have the same (if any) DST change-over dates. For example, India is currently at UTC+05:30, probably because they wrapped the entire country in the same TZ after their independence. Alban Hertroys -- If you can't see the forest for the trees, c

Re: [GENERAL] A unique pairs version of UNNEST() ?

2016-01-05 Thread Alban Hertroys
to be looking for is the list of possible unique combinations, as sets of elements of the total set (sets are orderless). with list_of_ids as ( select unnest(list_of_ids) as id from table ) select a.id, b.id from list_of_ids a, list_of_ids b where b.id > a.id; Alban Hertroys -- If

Re: [GENERAL] Definitive answer: can functions use indexes?

2016-01-07 Thread Alban Hertroys
to any standard behaviour and could even behave differently or (more likely) not work at all on other PG instances. That said, it's not uncommon in BI to require a seq. scan anyway, in which case the point is rather moot. Regards, Alban Hertroys -- If you can't see the forest for th

Re: [GENERAL] WIP: CoC V2

2016-01-11 Thread Alban Hertroys
ople are all being so polite about it that it's almost offensive! Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscriptio

Re: [GENERAL] Code of Conduct: Is it time?

2016-01-12 Thread Alban Hertroys
On 12 January 2016 at 09:25, Chris Travers wrote: > One of the dangers of a CoC is that there are many potential issues which > may or may not become real problems. I think if we try to be clear on all > of them, then we risk creating codes instead of a general expectation of > what we do expect

Re: [GENERAL] Let's Do the CoC Right

2016-01-24 Thread Alban Hertroys
d all Cocs at least 3 times in this whole > conversation. > > Thanks, > Regina What about this for a CoC?: 1. Do not discuss a CoC. But, this side-thread has been going on long enough I think. Let's wrap this up, shall we? Regards, Alban Hertroys -- If you can't

Re: [GENERAL] execute same query only one time?

2016-02-08 Thread Alban Hertroys
copying of columns" in your reply to Adrian's solution, but I don't think that happens here. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@

Re: [GENERAL] Test CMake build

2016-02-10 Thread Alban Hertroys
//github.com/stalkerg/postgres_cmake > > The compilation will be enough (tests even better). I need feedbacks so that > create issues on github. > Very interesting NetBSD, OpenBSD, Solaris. I was under the impression that the FreeBSD port already uses cmake? Alban Hertroys -- If you can&#x

Re: [GENERAL] Optimize Query

2016-02-14 Thread Alban Hertroys
query-template with enough placeholders and views that there is no way to predict how that's going to perform without at least knowing what goes into the placeholders and how the views are built up. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you&#

Re: [GENERAL] Optimize Query

2016-02-14 Thread Alban Hertroys
ough explain analyze again. It wouldn't surprise me if that query is already significantly faster. If you're still having problems at that point, post that query and the analysis again. > Explain analyze link: > http://explain.depesz.com/s/5WJy Alban Hertroys -- If you can't

Re: [GENERAL] Why does query planner choose slower BitmapAnd ?

2016-02-22 Thread Alban Hertroys
o contain something a bit more meaningful though... Well, enough of my rambling! Ad 1. It is possible that you cater for the possibility that you don't know whether a "contact" has a phone number or not, in which case null would probably be the wrong choice for "no phone

Re: [GENERAL] pg_restore real file size

2016-02-26 Thread Alban Hertroys
ore (or can it restore using plain text sql scripts these days?) instead of psql. Lastly, how does a database in unicode fare for text size (without toasted values) against a plain text dump file in, say, utf-8 - which isn't even the worst case scenario? That's the simplistic cas

Re: [GENERAL] Really unique session ID - PID + connection timestamp?

2016-04-10 Thread Alban Hertroys
s? > > > We want create same mechanism. > > If the above questions did not already cover this, what mechanism? > > > I know there are adv. locks in PG, but I want to use session id. > > This could be: > |pg_backend_pid|() > > May pid repeats. > Where

Re: [GENERAL] Why is the comparison between timestamp and date so much slower then between two dates

2016-04-13 Thread Alban Hertroys
timestamptz now() to a date ;) That's basically what you're doing when you use current_date instead of now(). The reason that the other way around is so much more expensive is that the database needs to do that conversion twice for every row in the table. When down-converting now(),

Re: [GENERAL] Why is the comparison between timestamp and date so much slower then between two dates

2016-04-14 Thread Alban Hertroys
ly once, but the slow-down is caused by having to do conversions (for two field values) for every row. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.

Re: [GENERAL] Slow join over three tables

2016-04-27 Thread Alban Hertroys
ck pain - nonspecific', 'nonspecific back pain', 'back pain']) AND d.drug = ANY (ARRAY[359, 360, 361, 362, 363]) ) x ON x.rid = r.id ORDER BY r.created; Looking at the cardinality of your tables that does seem a bit unlikely though. Still, worth a shot... Alban

Re: [GENERAL] Slow join over three tables

2016-04-28 Thread Alban Hertroys
On 28 April 2016 at 08:36, Tim van der Linden wrote: > On Wed, 27 Apr 2016 13:48:06 +0200 > Alban Hertroys wrote: > >> In this case, you're using the values in adverse to filter relevant rid's >> for the FK join, so you might be better off with the inverse of abo

Re: [GENERAL] (VERY) Slow Query - PostgreSQL 9.2

2016-05-03 Thread Alban Hertroys
dundancy in the index would probably help: create index gorfs.inodes_accounts_idx on gorfs.inodes (substring (full_path from 20)) where full_path like '/userfiles/account/%'; and then use similar expressions in your query of course: where full_path like '/userfiles/account/%&#

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Alban Hertroys
On 4 May 2016 at 17:08, John McKown wrote: > I had a manager, long ago, who used a Lotus 1-2-3 spreadsheet to > contain all his memos. I was glassy eyed in disbelief. He also would use his > hand calculator to add up the numbers in the spreadsheet to be sure that the > summation function in the sp

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-05 Thread Alban Hertroys
d there. It probably gets interpreted as a column name. > END IF; > IF (TG_OP = 'INSERT') THEN > UPDATE public.companies SET client_code_increment = > (client_code_increment + 1) WHERE id = NEW.id; > END IF; > RETURN NEW; > END; > $

Re: [GENERAL] full text search index

2016-05-26 Thread Alban Hertroys
REATE OR REPLACE FUNCTION public.full_text_universal_cast(doc_data >> "text") >> RETURNS "tsvector" AS >> $BODY$ >> SELECT to_tsvector('english', COALESCE(TRIM(CAST(doc_data AS TEXT)), '')); >> $BODY$ >> LANGUAGE sql IMMUTABLE

Re: [GENERAL] why postgresql over other RDBMS

2007-06-04 Thread Alban Hertroys
regards, tom lane Interesting concept (as expected from you guys). Would that imply that the sequential scan of one connection could place data into the disk cache that another parallel seq scan would need soon? Would that speed up parallel seq scans? Or am I being optimistic h

Re: [GENERAL] using subselects

2007-06-07 Thread Alban Hertroys
t; WHERE user_id <> $current_user_id > AND user_id <> ( SELECT user_id FROM user_projects WHERE project_id = > $project_id ) > > This query returns no rows, even on projects that have no records in > the user_projects table! I suppose you meant to use: AND user_id NOT I

Re: [GENERAL] querying the age of a row

2007-06-08 Thread Alban Hertroys
;::interval IS NULL ...which is considered FALSE by the WHERE clause. It's probably wiser not to rely on that in your code though, it can be confusing ;) -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproduct

Re: [GENERAL] Using the GPU

2007-06-11 Thread Alban Hertroys
possible to move result sets around that way? Do joins even maybe? And then there are the vertex and pixel shaders... It'd be kind of odd though, to order a big time database server with a high-end gaming card in it :P -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)5

Re: [GENERAL] Postmaster processes taking all the CPU

2007-06-11 Thread Alban Hertroys
dernism. > --Brad Holland> > ---(end of broadcast)---> TIP 4: Have you searched our list archives?> > http://archives.postgresql.org/ > Could you please send your messages as plain text? Your mail client is

Re: [GENERAL] parametered views

2007-06-11 Thread Alban Hertroys
A1_table.A11, A1_table.A12 WHERE something2 = x UNION SELECT date_id, A_table_id, A2_table.A21, A2_table.A22 WHERE something2 <> x In case the records in the result sets matching something2 = x and the ones not matching are distinct or if you don't care about duplicates, use UN

Re: [GENERAL] performance problem with loading data

2007-06-11 Thread Alban Hertroys
that feels kludgy). For the technical people; would it be possible to use the statistics on the table(s) in the SELECT part of the statement to update the statistics of the table being inserted into? Maybe they wouldn't be entirely accurate, but it wouldn't it be more accurate than statist

Re: [GENERAL] Q: Tree traversal with SQL query?

2007-06-15 Thread Alban Hertroys
t tree traversal starting at root > (marked by parent == node, for example.) > > Obviously, I can do this with "normal" programming and loops, but it bugged > me a while if its at all possible doing this in one query. Have a look at contrib/ltree ;) -- Alban Hertroys [EMAIL

Re: Intervals (was: [GENERAL] DeadLocks..., DeadLocks...)

2007-06-18 Thread Alban Hertroys
w is that various query engines (ie. PHP's pg_ functions) don't know how to handle intervals. Suffice to say, I'm a big fan of the interval type. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postb

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-28 Thread Alban Hertroys
;m > unable to interpret it correctly without 'a paradigm mind shift'. > > So, would you mind commenting a little on how exactly the t1.id > influences subquery (with t3), and the result influences back the > selection of t1 set? > > Will greatly apreciate that. --

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alban Hertroys
erminates, or optionally on commit if specified that way (ON COMMIT DROP). -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede // Integrate Your World // ---

Re: [GENERAL] query to match '\N'

2007-07-30 Thread Alban Hertroys
esumably he wanted col2 like E'%N%'. But doesn't \N mean NULL, or would the OP be looking for literal '\N' strings in his data? Because if he's looking for NULLs it may be better to query for col2 IS NULL. -- Alban Hertroys [EMAIL PROTE

Re: [GENERAL] query to match '\N'

2007-07-30 Thread Alban Hertroys
Nis Jørgensen wrote: > Alban Hertroys skrev: > >> Presumably he wanted col2 like E'%N%'. >> But doesn't \N mean NULL, or would the OP be looking for literal '\N' >> strings in his data? Because if he's looking for NULLs it may be better &g

[GENERAL] psql 8.2 client vs pg 8.1 server problem

2007-07-31 Thread Alban Hertroys
ine editing database> select version(); version - PostgreSQL 8.1.4 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 3.3.5 (Debian 1:3.3.5-13) (1 row) -- Alban H

Re: [GENERAL] psql 8.2 client vs pg 8.1 server problem

2007-07-31 Thread Alban Hertroys
Dave Page wrote: > Alban Hertroys wrote: >> We have psql 8.2 clients on our workstations, while we still have pg 8.1 >> on our development and production servers. This causes problems like the >> following: >> >> database> \d table >> ERROR: colu

Re: [GENERAL] What do people like to monitor (or in other words, what might be nice in pgsnmpd)?

2007-08-02 Thread Alban Hertroys
ries that take more than an arbitraty amount of time to complete. Maybe per user/database? I suppose this number is only interesting on an uncongested database server. Otherwise there will be queries passing that treshold that normally wouldn't, because they have to wait for the real troublemake

Re: [GENERAL] Modified FIFO queue and insert rule

2007-08-08 Thread Alban Hertroys
te statement, and thus id <> NEW.id. You should probably use a trigger (a before one maybe) instead of a rule. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede // Integrate Yo

Re: [GENERAL] LIKE conditions in PGSQL very, very slow!

2007-08-13 Thread Alban Hertroys
h 'eri', in which case a seq scan is actually faster... In that case you should probably do something about your customer base ;) Regards, -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500

Re: [GENERAL] Moving to postgresql and some ignorant questions

2007-08-14 Thread Alban Hertroys
Also a nice trick, when performing DDL statements (CREATE TABLE and friends), you can wrap them in a transaction and commit (or rollback) if you like the end result (or not). I believe the only exception to that rule is CREATE DATABASE. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T

Re: [GENERAL] [RESEND] Transaction auto-abort causes grief with Spring Framework

2007-08-17 Thread Alban Hertroys
nd? I realize it would be difficult to override the behaviour of try {...} catch (...) {...}, but it shouldn't be too hard to wrap it somehow for exceptions in database code. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproduct

Re: [GENERAL] [RESEND] Transaction auto-abort causes grief with Spring Framework

2007-08-17 Thread Alban Hertroys
auditing. Your application will need twice as many connections that way, though... In that case you shouldn't commit records on the 'normal' connection before the audit records have been committed I suppose? -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874

Re: [GENERAL] Repeat posts

2007-08-17 Thread Alban Hertroys
any wayI was just > wondering if anyone else has noticed it. I just finished going through my new mail since this morning, which contained several fresh duplicates of messages I already read. So yes, it happens to me too. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++

Re: [GENERAL] Converting non-null unique idx to pkey

2007-08-23 Thread Alban Hertroys
'. Since you're setting up replication to another database, you might as well try replicating to a newer release and swap them around once it's done. I've seen that method of upgrading mentioned on this list a few times. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v.

Re: [GENERAL] PostgreSQL vs Firebird feature comparison finished

2007-08-24 Thread Alban Hertroys
cific operating system, but I think FreeBSD should be added to that list as well... They've been bench marking their threading support using multi-threading in MySQL (not for the db, mind you - just for load ;), and it performs really well. -- Alban Hertroys [EMAIL PROTECTED] magproductions b

Re: [GENERAL] PostgreSQL vs Firebird feature comparison finished

2007-08-24 Thread Alban Hertroys
Dave Page wrote: > Alban Hertroys wrote: >> Joshua D. Drake wrote: >>>> I agree with you on the multi-threaded. I think I will add a note >>>> saying the the multi-threaded architecture is only advantageous on >>>> Windows. >>> And Solaris.

Re: [GENERAL] SQL Diff ?

2007-08-27 Thread Alban Hertroys
at's the best way to select all > rows that have been changed, modified in table1 since the initial laod from > table1 into table2? I think you could get smart having a few rules for insert/update/delete on 'table' that "keep track" of what happens du

Re: [HACKERS] [GENERAL] Undetected corruption of table files

2007-08-27 Thread Alban Hertroys
database on a filesystem that has reliable integrity verification mechanisms. In the worst case (all the above mechanisms fail), you have backups. IMHO the problem is covered quite adequately. The operating system and the hardware cover for the database, as they should; it's _their_ job. --

[GENERAL] Obtaining random rows from a result set

2007-08-31 Thread Alban Hertroys
? Desirable? Necessary? If I'd have time I'd volunteer for at least looking into this, but I'm working on three projects simultaneously already. Alas... Regards, Alban Hertroys. -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M:

  1   2   3   4   5   6   7   8   9   10   >