Re: [GENERAL] Asynchronous query execution

2010-12-08 Thread Robert Gravsjö
. But in few situations it is required not to wait for getting the completion of previous sql statement. How can this e achieved? Is this what you're looking for: http://www.postgresql.org/docs/current/interactive/libpq-async.html Waiting for you response. CPK -- Regards, Robert &qu

[GENERAL] Invalid byte sequence

2010-12-09 Thread Robert Fitzpatrick
Version: 1.11-0 ; Format: CUSTOM ; Integer: 4 bytes ; Offset: 8 bytes ; Dumped from database version: 8.4.0 ; Dumped by pg_dump version: 8.4.0 Is it the WITH_INTDATE option and I should rebuild or something else causing this error? --Robert -- Sent via pgsql-general mailing lis

Re: RES: [GENERAL] Using regexp_replace to remove small words

2010-12-13 Thread Robert Gravsjö
aces after the removal and handle beginning and end of the word, you will need to expand this to cover those cases, but the example should contain the key ingredients. -- Regards, Robert "roppert" Gravsjö -- 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] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-16 Thread Robert Gravsjö
E DATABASE foo TEMPLATE bar" will clone bar as foo including data. Of course this only works within the same cluster. So we need to use slow and unsafe dump/restore over internet for this also. Andrus. -- Regards, Robert "roppert" Gravsjö -- Sent via pgsql-general ma

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-16 Thread Robert Gravsjö
On 2010-12-16 11.12, Andrus Moor wrote: Robert, I'm probably misunderstanding but "CREATE DATABASE foo TEMPLATE bar" will clone bar as foo including data. Of course this only works within the same cluster. Than you. You are genious I haven't never tought about this

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-16 Thread Robert Gravsjö
ATE DATABASE will fail if any other connection exists when it starts; Are there any other side effects to this besides failing CREATE DATABASE command? -- Regards, Robert "roppert" Gravsjö -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

[GENERAL] Constraining overlapping date ranges

2010-12-21 Thread McGehee, Robert
lso appreciate it if anyone can provide any indexing hints on this table to optimize queries like: SELECT value FROM tbl WHERE id=2 and '2010-12-02' BETWEEN start_date AND stop_date; Thanks in advance, and sorry if I overlooked any obvious documentation! Robert McGehee -- Sent via pgs

Re: [GENERAL] Constraining overlapping date ranges

2010-12-22 Thread McGehee, Robert
rested: http://thoughts.j-davis.com/2010/09/25/exclusion-constraints-are-generalized-sql-unique/ Thanks, Robert PS. I don't think the f_point function is necessary. Something like: ... EXCLUDE USING gist (id WITH =, f_period(start_date, end_date) WITH &&) seems equivalent to y

Re: [GENERAL] My DataBase can't accept conntecion

2011-01-12 Thread Robert Gravsjö
solve? -- Regards, Robert "roppert" Gravsjö -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] key=value imports

2011-01-19 Thread Robert Fitzpatrick
there a better way or some contrib that would help better? Thanks, Robert -- Robert This e-mail message was delivered to you by a WebTent ESMTP mail gateway after it has been filtered for spam and viruses, see the headers of

[GENERAL] Moving from SQL Anywhere to PostGres - First Time

2011-01-20 Thread Robert Paresi
DATE/TIME stamp fields together. 5. What UI/Developer tools (GUI) are available to manage the database as well as add/change columns rather than doing it via SQL commands. Thank you. -Robert -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Moving from SQL Anywhere to PostGres - First Time

2011-01-20 Thread Robert Paresi
affect us, and won't make any exceptions or changes for us, so now is the time to start looking at our options. -Robert "Michael Gould" wrote in message news:393bf55cebd45c71fec623552acbd...@intermodalsoftwaresolutions.net... Robert, We used Data Manager from JP to do this. W

Re: [GENERAL] Privileges of Users

2011-01-21 Thread Robert Gravsjö
find. Thanks & Regards Adarsh Sharma use \dp in psql And regarding the \G, it's for vertical output in mysql if I remember correctly. The closest to this would be \x in psql. -Andy -- Regards, Robert "roppert" Gravsjö -- Sent via pgsql-general mailing

[GENERAL] Need help accessing TABLES, COLUMNS, DESCRIPTIONS

2011-01-21 Thread Robert Paresi
Hello, I can't figure this out, and need help. I need access (VIA SQL Statements) to retreive a list of all PUBLIC tables, columns and their descriptions. I found: tables columns pg_description 1. There is no link between the description (object ID and the tables/columns) 2. pg_description

Re: [HACKERS] [GENERAL] Large object corruption during 'piped' pg_restore

2011-01-21 Thread Robert Haas
be lightly tested, but it's a pretty confined change, so it's unlikely to break anything else. ISTM the worst case scenario is that it takes two minor releases to get it right, and even that seems fairly unlikely. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Ente

Re: [GENERAL] Moving from SQL Anywhere to PostGres - First Time

2011-01-25 Thread Robert Paresi
e from accounts highlight balance where balance < 0 bgcolor=COLOR:RED -Robert "Jasen Betts" wrote in message news:ihmf86$98d$1...@reversiblemaps.ath.cx... On 2011-01-20, Robert Paresi wrote: Hello, We have 700 user install base using Sybase SQL Anywhere 9.02 We ar

Re: [GENERAL] set theory question

2011-02-03 Thread Wappler, Robert
gt; book online, I can recommend "Foundations of Databases" (Abiteboul, Hull, Vianu) http://www.amazon.com/Foundations-Databases-Logical-Serge-Abiteboul/dp/0 201537710 -- Robert... -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes t

[GENERAL] plperl.dll on windows with postgresql 9.0

2011-02-04 Thread Robert Fitzpatrick
ler. Is there a plperl package that I need to install similar to Unix? Thanks. -- Robert -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] plperl.dll on windows with postgresql 9.0

2011-02-06 Thread Robert Fitzpatrick
ler. Is there a plperl package that I need to install similar to Unix? Thanks. -- Robert -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] plperl.dll on windows with postgresql 9.0.3

2011-02-08 Thread Robert Fitzpatrick
tomed to under BSD, is that right and it should find without further config or installs? Thanks. -- Robert -- 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] plperl.dll on windows with postgresql 9.0.3

2011-02-08 Thread Robert Fitzpatrick
On 2/8/2011 11:58 AM, Robert Fitzpatrick wrote: > could not load library “C:/Program Files/PostgreSQL/8.3/lib/plperl.dll”: > The specified module could not be found. SQL state: 58P01 Sorry the correct error I am getting is... could not load library “C:/Program Files/PostgreSQL/9.0/lib/plpe

Re: [HACKERS] [GENERAL] Issues with generate_series using integer boundaries

2011-02-08 Thread Robert Haas
tgresql.org/wiki/PostgreSQL_9.1_Open_Items -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] Possible Bug

2011-02-09 Thread Robert Gravsjö
#x27;t expect. Could you tell me if this is a bug or some feature I haven't heard of. Look up functional notation in http://www.postgresql.org/docs/9.0/static/xfunc-sql.html#AEN46042 These are the same thing: select name(test1) from test1; select test.name from test1; Best regards, Kaloy

Re: [GENERAL] plperl.dll on windows with postgresql 9.0.3

2011-02-09 Thread Robert Fitzpatrick
On 2/8/2011 12:03 PM, Robert Fitzpatrick wrote: > On 2/8/2011 11:58 AM, Robert Fitzpatrick wrote: >> could not load library “C:/Program Files/PostgreSQL/8.3/lib/plperl.dll”: >> The specified module could not be found. SQL state: 58P01 > > Sorry the correct error I am getting

Re: [GENERAL] GUC configuration

2011-02-10 Thread Wappler, Robert
On %D, %SN wrote: %Q %C -- Robert... > -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of T ?apap?t??? > Sent: Thursday, February 10, 2011 2:18 PM > To: pgsql-general@postgresql.org > Subj

Re: [GENERAL] PG on two nodes with shared disk ocfs2 & drbd

2011-02-27 Thread Robert Treat
someone is looking to fund/help development of such a thing, it might be worth pointing people to Postgres-XC (http://wiki.postgresql.org/wiki/Postgres-XC). It's got a ways to go, but they are at least trying. Robert Treat play: xzilla.net work: omniti.com hiring: l42.org/Lg -- Sent via pgsq

Re: [GENERAL] Question about switchover with PG9 replication

2011-02-27 Thread Robert Treat
The issue is more just that the built in replication system isn't very mature yet. It's being worked on, and switchover is something on the list, but it's not an option yet. Robert Treat play: xzilla.net work: omniti.com hiring: l42.org/Lg -- Sent via pgsql-general mailing list

Re: [GENERAL] searchable database

2011-04-10 Thread Robert Soulliere
r what you need, but will give you versatility and flexibility for expanding your resources to other materials if you ever need to do so. Moreover, they will provide all kinds of built in search options such as searching by subject, author, etc.. Regards, Robert On Sun, Apr 10, 2011 at 1:37

Re: [GENERAL] Shared memory changes in 9.4?

2014-05-27 Thread Robert Haas
of those we would have found if the default had been none. I tend to think DSM is an important facility that we're going to be wanting to build on in future releases, so I'm keen to have it available by default so that we can iron out any kinks before we get too far down that path

Re: [HACKERS] [GENERAL] Question about partial functional indexes and the query planner

2014-06-11 Thread Robert Haas
oubtful that anyone will get upset if their query plans change between beta1 and beta2, but the same cannot be said for released branches. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-general mailing list (pgsql-general@postgresql

[GENERAL] Role inheritance and Conflicting Parameter Values

2014-06-23 Thread McGehee, Robert
ameter values for another user to make sure I set this correctly. For instance, I'd like to run a query in the spirit of this invalid query: "SHOW statement_timeout FOR user1;". Unfortunately, SHOW only shows my parameters, though it would be nice to examine other accounts. Thanks, R

[GENERAL] Aggregating over nodes in hierarchical trees

2014-09-10 Thread McGehee, Robert
t.course ~ '.*' || n.node || '.*' GROUP BY n.node; My hope that this query would return this: node students --- Arts36 English 10 Biology 53 Unfortunately, this query gives the error: ERROR: syntax error at position 0 LINE 3: WHERE t.course ~ '.*

[GENERAL] How can i monitor exactly what (partition) tables are accessed by a query?

2014-09-18 Thread Robert Nix
I'm experiencing a problem with queries apparently not using the check constraints of my partition tables (tried constraint_exclusion =partition and =on with same results) and explain isn't sufficient to diagnose the issue because the value for the check constraint in the query comes from a join co

Re: [GENERAL] How can i monitor exactly what (partition) tables are accessed by a query?

2014-09-18 Thread Robert Nix
, Sep 18, 2014 at 9:22 PM, Jov wrote: > > Jov > blog: http:amutu.com/blog <http://amutu.com/blog> > > 2014-09-19 2:44 GMT+08:00 Robert Nix : > >> I'm experiencing a problem with queries apparently not using the check >> constraints of my partition tables (

Re: [GENERAL] Re: How can i monitor exactly what (partition) tables are accessed by a query?

2014-09-18 Thread Robert Nix
:39 PM, David G Johnston < david.g.johns...@gmail.com> wrote: > Robert Nix wrote > > I'm experiencing a problem with queries apparently not using the check > > constraints of my partition tables (tried constraint_exclusion =partition > > and =on with same result

[GENERAL] Modeling Friendship Relationships

2014-11-11 Thread Robert DiFalco
I have a question about modeling a mutual relationship. It seems basic but I can't decide, maybe it is 6 of one a half dozen of the other. In my system any user might be friends with another user, that means they have a reciprocal friend relationship. It seems I have two choices for modeling it.

[GENERAL] String searching

2014-11-17 Thread Robert DiFalco
rches will always be like the following. User specifies a word (e.g. "John") and I have a field called "FullName" that could return records with "John Doe", "Robert Johnson", "Joe Johnson Smith", etc. I may also extend the search criteria to other

Re: [HACKERS] [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-17 Thread Robert Haas
a *non*-MCV can require a switch to a custom plan, which is something I don't think I've seen before. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- 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] String searching

2014-11-18 Thread Robert DiFalco
Thanks everyone. Either I'm not that smart or I am working on too many things at once (or both) but making Full Text work seems super tedious. I just have a single VARCHAR field for name, so the full name "William S. Burroughs" is a single row and column. I want to as simply as possible have the a

Re: [HACKERS] [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-19 Thread Robert Haas
On Mon, Nov 17, 2014 at 4:27 PM, Tom Lane wrote: > Robert Haas writes: >> On Thu, Nov 13, 2014 at 7:34 PM, Tom Lane wrote: >>> One thing that occurs to me is that if the generic plan estimate comes >>> out much cheaper than the custom one, maybe we should assume

Re: [GENERAL] Modeling Friendship Relationships

2014-11-20 Thread Robert DiFalco
saying that you would not remove both rows? Thanks! On Thu, Nov 13, 2014 at 8:10 AM, Jonathan Vanasco wrote: > > On Nov 11, 2014, at 5:38 PM, Robert DiFalco wrote: > > > Thoughts? Do I just choose one or is there a clear winner? TIA! > > > I prefer this model > >

Re: [GENERAL] Help Optimizing a Summary Query

2014-12-09 Thread Robert DiFalco
.id <http://u.id>* LEFT OUTER JOIN friend_requests s ON s.to_id = 33 AND s.from_id = u.id LEFT OUTER JOIN friend_requests r ON r.to_id = u.id AND r.from_id = 33 WHERE u.id != 33 AND u.name LIKE '%John%' ORDER BY u.name; On Tue, Dec 9, 2014 at 10:15 AM, Robert DiFalco wr

[GENERAL] Help Optimizing a Summary Query

2014-12-10 Thread Robert DiFalco
I have users, friends, and friend_requests. I need a query that essentially returns a summary containing: * user (name, imageURL, bio, ...) * Friend status (relative to an active user) * Is the user a friend of the active user? * Has the user sent a friend request to the acti

Re: [GENERAL] Help Optimizing a Summary Query

2014-12-11 Thread Robert DiFalco
OUTER JOINs vs EXISTS queries and if there was a better alternative I had not considered. On Tue, Dec 9, 2014 at 11:44 AM, Arthur Silva wrote: > On Tue, Dec 9, 2014 at 4:18 PM, Robert DiFalco > wrote: > >> I'm sorry, I missed a JOIN on the second variation. It is: >> >

[GENERAL] Combining two queries

2014-12-18 Thread Robert DiFalco
I have a table called friends with a user_id and a friend_id (both of these relate to an id in a users table). For each friend relationship there are two rows. There are currently ONLY reciprocal relationships. So if user ids 1 and 2 are friends there will be two rows (1,2) and (2,1). For 2 arbit

Re: [GENERAL] Combining two queries

2014-12-18 Thread Robert DiFalco
David G Johnston < david.g.johns...@gmail.com> wrote: > > Robert DiFalco wrote > > For 2 arbitrary ids, I need a query to get two pieced of data: > >* Are the two users friends? > > This seems easy...ROW(u_id, f_id) = ROW(n1, n2) > > > >* How many f

Re: [GENERAL] Combining two queries

2014-12-18 Thread Robert DiFalco
cost approach than what I was already doing. On Thu, Dec 18, 2014 at 2:07 PM, David Johnston wrote: > > On Thu, Dec 18, 2014 at 3:02 PM, Robert DiFalco > wrote: > >> Is the intersect any better than what I originally showed? On the ROW >> approach, I'm not sure

[GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
sers are created. For example, a client may submit {"name":"Robert", "hometown":"Portland"}. The hometowns table will never be updated, only either queries or inserted. So given this I need to INSERT a row into "users" and either SELECT the homet

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
x27; WHERE NOT EXISTS (SELECT 1 FROM sel) RETURNING id ) INSERT INTO users(name, hometown_id) VALUES ('Robert', SELECT id FROM ins UNION ALL SELECT id FROM sel); On Tue, Jan 13, 2015 at 8:50 AM, John McKown wrote: > On Tue, Jan 13, 2015 at 10:42 AM, Robert DiFalco > wro

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
This CTE approach doesn't appear to play well with multiple concurrent transactions/connections. On Tue, Jan 13, 2015 at 10:05 AM, John McKown wrote: > On Tue, Jan 13, 2015 at 11:45 AM, Robert DiFalco > wrote: > >> Thanks John. I've been seeing a lot of examples like

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
Well, traditionally I would create a LOOP where I tried the SELECT, if there was nothing I did the INSERT, if that raised an exception I would repeat the LOOP. What's the best way to do it with the CTE? Currently I have the following which gives me Duplicate Key Exceptions when two sessions try to

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
switching you are buying > yourself much (if anything) by using a CTE query instead of something > more traditional here. > > The advantages of switching to a CTE would be if this code was all > being done inside of the app code with multiple queries. > > On Tue, Jan 13, 2015

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-13 Thread Robert DiFalco
Good points. I guess my feeling is that if there can be a race condition on INSERT then the CTE version is not truly atomic, hence the LOOP. On Tue, Jan 13, 2015 at 3:11 PM, Brian Dunavant wrote: > A very good point, but it does not apply as here (and in my article) > we are not using updates, o

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-15 Thread Robert DiFalco
insert into hometowns (name) > select hometown_name where v_id is null > returning id into v_id; > EXCEPTION WHEN unique_violation > THEN > select id into v_id from hometowns where name = hometown_name; > END; > insert into users (name, hometown_id) > values

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-15 Thread Robert DiFalco
name = hometown_name; > BEGIN > insert into hometowns (name) > select hometown_name where v_id is null > returning id into v_id; > EXCEPTION WHEN unique_violation > THEN > select id into v_id from hometowns where name = hometown_name; > END; > inse

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-16 Thread Robert DiFalco
The code shown in the Doc (I think) will still give you deadlock in the case where you have two sessions concurrently trying to insert the same 'hometown'. For example: INSERT INTO users VALUES('Tom', select_hometown_id('Portland, OR')); INSERT INTO users VALUES(''Waits', select_hometown_id('P

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-16 Thread Robert DiFalco
ld be picked up. And there should only be a quick recoverable deadlock. On Fri, Jan 16, 2015 at 7:49 AM, Daniel Verite wrote: > Robert DiFalco wrote: > > > I must be doing something wrong because both of these approaches are > giving > > me deadlock exceptions. > >

[GENERAL] asynchronous commit

2015-01-19 Thread Robert DiFalco
I have several tables that I use for logging and real-time stats. These are not critical and since they are a bottleneck I want transactions against them to always be asynchronous. Is there a way to specify this at a table level or do I have to make sure to call set synchronous_commit='off' every

Re: [GENERAL] asynchronous commit

2015-01-19 Thread Robert DiFalco
be my understanding is off. On Mon, Jan 19, 2015 at 11:10 AM, Andreas Kretschmer < akretsch...@spamfence.net> wrote: > Robert DiFalco wrote: > > > I have several tables that I use for logging and real-time stats. These > are not > > critical and since they are a bottleneck I

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-19 Thread Robert DiFalco
Hometowns get selected and possibly inserted in unpredictable ways even from multiple concurrent sessions. The only way I could figure out how to solve it was to force each INSERT hometowns to be in its own transaction. On Mon, Jan 19, 2015 at 1:56 PM, Robert DiFalco wrote: > I don't

Re: [GENERAL] Simple Atomic Relationship Insert

2015-01-19 Thread Robert DiFalco
I don't think an advisory lock would remove the deadlock. On Sun, Jan 18, 2015 at 10:33 PM, Roxanne Reid-Bennett wrote: > On 1/16/2015 2:41 AM, Jim Nasby wrote: > >> On 1/15/15 10:57 PM, Roxanne Reid-Bennett wrote: >> >>> >>> try this: (if you still get deadlocks, uncomment the advisory lock >>

Re: [GENERAL] Large number of rows in pg_type and slow gui (pgadmin) refresh

2013-01-03 Thread Robert Klaus
Yes, I consider it a tool issue and not a database issue. Is there somewhere else I should be posting this to? Thanks, Robert -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Thomas Kellerer Sent: Thursday, January 03

[GENERAL] Combining validation into main query

2013-01-12 Thread Robert James
Typically, my web application does some initial validation, then, if it passes, does the actual query. For both performance and simplicity, I'd like to combine these all into one trip to Postgres. Ideally, I'd like to do this in SQL. If that's not possible, I could use PL/pgsql, though I'm not ad

[GENERAL] Bulk INSERT with individual failure

2013-01-13 Thread Robert James
I need to INSERT a large number of records. For performance reasons, I'd rather send them to Postgres in one giant INSERT. However, if there's a problem in one record (eg one row doesn't meet a constraint), I'd still like the others saved. That is, I specifically DO NOT want atomic behavior. It

Re: [GENERAL] INSERT... WHERE

2013-01-13 Thread Robert James
On 1/13/13, Ian Lawrence Barwick wrote: > 2013/1/14 Robert James : >> I have a lot of VALUES I want to INSERT. But only a subset of them - >> only those that meet a JOIN criteria involving another table. >> >> I could INSERT them into a temp table, and then do a SELECT

Re: [GENERAL] INSERT... WHERE

2013-01-14 Thread Robert James
On 1/13/13, Chris Angelico wrote: > On Mon, Jan 14, 2013 at 3:37 PM, Robert James > wrote: >> Thanks. But how do I do that where I have many literals? Something like: >> >> INSERT INTO seltest (id, a, b) SELECT (1,2,3),(4,5,6),(7,8,9) WHERE b >> IN (SELECT ...) &

[GENERAL] Independent backups of subdatabases

2013-01-15 Thread Robert James
I'd like to organize tables into different groups. This is for 3 reasons: 1. Each group needs to be backed up and restored independently from the others 2. Each group has different permissions for particular users 3. As an aid to human understanding organization I would do this as actual database

[GENERAL] argument of AND must not return a set when using regexp_matches

2013-01-16 Thread Robert James
I've been getting a funny SQL error, which I've boiled down to this case. SELECT (regexp_matches('abc', '(.)b(.)'))[1] IS NOT NULL -- Returns true, as expected SELECT (regexp_matches('abc', '(.)b(.)'))[1] IS NOT NULL AND true -- Gives this error: ERROR: argument of AND must not return a set SQL s

[GENERAL] Temp table's effect on performance

2013-01-18 Thread Robert James
I'd like to understand better why manually using a temp table can improve performance so much. I had one complicated query that performed well. I replaced a table in it with a reference to a view, which was really just the table with an inner join, and performance worsened by 2000x. Literally.

[GENERAL] Understanding TIMESTAMP WITH TIME ZONE

2013-01-18 Thread Robert James
I'd like to better understand TIMESTAMP WITH TIME ZONE. My understanding is that, contrary to what the name sounds like, the time zone is never stored. It simply stores a UTC timestamp, identical to what TIMESTAMP WITHOUT TIME ZONE stores. And then the only difference is that WITH TIME ZONE will

Re: [GENERAL] Temp table's effect on performance

2013-01-18 Thread Robert James
On 1/18/13, Tom Lane wrote: > Jeff Janes writes: >> On Fri, Jan 18, 2013 at 9:29 AM, Robert James >> wrote: >>> In other words: Since my query is 100% identical algebraicly to not >>> using a temp table, why is it so much faster? Why can't the pl

Re: [GENERAL] Understanding TIMESTAMP WITH TIME ZONE

2013-01-20 Thread Robert James
On 1/18/13, Steve Crawford wrote: > On 01/18/2013 09:31 AM, Robert James wrote: >> I'd like to better understand TIMESTAMP WITH TIME ZONE. >> >> My understanding is that, contrary to what the name sounds like, the >> time zone is never stored. It simply stores

[GENERAL] cleanup of pgsql_tmp directory

2013-02-05 Thread Robert Klaus
order for this to happen? It's been 30 minutes since the process was killed. Also, is there some method of governing the temporary space used? Our temp_tablespace parameter is null. Thanks Robert

Re: [GENERAL] cleanup of pgsql_tmp directory

2013-02-05 Thread Robert Klaus
, February 05, 2013 12:07 PM To: Robert Klaus Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] cleanup of pgsql_tmp directory "Robert Klaus" writes: > This morning we found out that our filesystem was at 98% and filling > quickly. We immediately found one query running for

[GENERAL] cleanup of pgsql_tmp directory

2013-02-05 Thread ROBERT KLAUS
Updating: I found two other sessions running the same query. Once I killed them the pg_tmp files were automatically deleted. >> This morning we found out that our filesystem was at 98% and filling quickly. We immediately found one query running for a long time and saw 1500+ files in the pg

[GENERAL] could not load plperl library

2013-04-03 Thread Robert Fitzpatrick
, let me know if not, thanks -- Robert -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Triggers on Foreign Tables

2013-04-04 Thread Robert Lefkowitz
Not sure if this is a feature request or a bug report. I'm trying to use Foreign Tables for a variety of things and it is useful to have a foreign table which appears to be read/write. Having set one up, I can select data from it. However, I can't insert, update or delete. No worries, thinks

Re: [GENERAL] could not load plperl library SOLVED

2013-04-04 Thread Robert Fitzpatrick
Paolo Saudin Wednesday, April 03, 2013 3:10 PM Try to check the perl version against Postgres version at http://forums.enterprisedb.com/posts/list/3295.page Thanks! I'm using postgresql 9.2 and needed 5.14, luckily still available.

Re: [GENERAL] Oracle to PostgreSQL transition?

2013-04-05 Thread Robert Treat
x27;s the latter, you'll probably need to write your own tools; at least we've always done that as we've never found anything that worked with both Oracle and MSSQL into Postgres reliably; but really it shouldn't be too difficult; basically just ETL or some home brew repli

Re: [GENERAL] upgrading from V8.3.4 to V9.2.4

2013-04-05 Thread Robert Treat
gsql was port to use the core lexer. Ideally you'll have some kind of test suite / regression you can run to verify all of this; if not you maybe you can set up some replication between old/new servers (we use mimeo for that when sever versions are this far apart) and point your app to both a

[GENERAL] Are partitions getting pruned?

2013-04-08 Thread Robert Klaus
;2013-03-17' and market = 'Chicago'; voice.daily_nbr_list_201304; AccessShareLock select * from voice.daily_nbr_list where item_date = '2013-03-17' and market = 'Chicago'; voice.daily_nbr_list_201305; AccessShareLock I noticed row exclusive locks being held on all partitions for procedure calls that update the data. Thanks, Robert

[GENERAL] Are partitions getting pruned?

2013-04-11 Thread ROBERT KLAUS
rket = 'Chicago'; voice.daily_nbr_list_201303; AccessShareLock select * from voice.daily_nbr_list where item_date = '2013-03-17' and market = 'Chicago'; voice.daily_nbr_list_201304; AccessShareLock select * from voice.daily_nbr_list where item_date = '2013-03-17' and market = 'Chicago'; voice.daily_nbr_list_201305; AccessShareLock I noticed row exclusive locks being held on all partitions for procedure calls that update the data. Thanks, Robert

[GENERAL] Using functions to calc field values in other table

2013-06-18 Thread Robert Fitzpatrick
I realize the syntax above may not work, just trying to get across my idea and hope for some guidance how all this could be done, if possible. Thanks for any pointers! -- Robert -- Robert -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

[GENERAL] Carry forward last observation

2013-06-19 Thread McGehee, Robert
les. SELECT x.dtidx, p.price FROM stk_prc p, (SELECT a.dtidx, max(b.dtidx) as lastidx FROM stk_prc a, stk_prc b WHERE a.dtidx>=b.dtidx AND b.price IS NOT NULL GROUP BY a.dtidx) x WHERE p.dtidx=x.lastidx; Thanks, Robert McGehee, CFA Geode Capital Management, LLC One Post

[GENERAL] Computing count of intersection of two queries (Relational Algebra --> SQL)

2013-07-07 Thread Robert James
In relational algebra, I have relation R and relation S, and want to find the cardinality of R, of S, and of R-intersect-S. I know the SQL for R and S. What's the best way to compute the cardinality of each relation (query) and of their intersection? -- Sent via pgsql-general mailing list (pgs

[GENERAL] Longest Common Subsequence in Postgres - Algorithm Challenge

2013-07-08 Thread Robert James
I have two relations, where each relation has two fields, one indicating a name and one indicating a position. That is, each relation defines a sequence. I need to determine their longest common subsequence. Yes, I can do this by fetching all the data into Java (or any other language) and comput

Re: [GENERAL] Longest Common Subsequence in Postgres - Algorithm Challenge

2013-07-08 Thread Robert James
On 7/8/13, hubert depesz lubaczewski wrote: > On Mon, Jul 08, 2013 at 09:09:26AM -0400, Robert James wrote: >> I have two relations, where each relation has two fields, one >> indicating a name and one indicating a position. That is, each >> relation defines a sequence. >

[GENERAL] Return cols and rows via stored procedure

2013-07-14 Thread Robert James
I'd like a stored procedure which does something like: INSERT INTO... SELECT... -- This should be returned as multicolumn, multifield - just like a table or view When I run it, though, instead of getting a table, I get one field with all the data in it as a compound type. I'd like to return the

[GENERAL] Parameter for query

2013-07-16 Thread Robert James
Is there any way to set a variable or parameter for a query? I have a long query where a certain variable needs to be easy to change. I'd like to do something like: threshold = 10.3 SELECT... WHERE x > $threshold... AND y * 1.3 > $threshold... Currently, I need to do this in a scripting langua

[GENERAL] Materializing a view by hand

2013-08-13 Thread Robert James
I have a view which is very slow to computer, but doesn't change often. I'd like to materialize it. I thought I'd do a simple poor man's materialize by: 1) ALTER VIEW myview RENAME to _myview 2) SELECT * INTO myview FROM _myview The only problem is that all my other views, which are dependent on

[GENERAL] What type of index do I need for this JOIN?

2013-08-13 Thread Robert James
I'm doing a JOIN which is very slow: JOIN t ON t.f1 LIKE (q.f1 || '%') t1 has an INDEX on (f1, f2) which I thought would help for this. But Postgres seems to still use a (very slow) Nested Loop. What type of index would be appropriate for this? (My goal is to join on a substring starting from

[GENERAL] SORT and Merge Join via Index

2013-08-13 Thread Robert James
I noticed that when I have an index on (a,b) of table t, and I do an SELECT * FROM t ORDER BY a ASC, it doesn't use the index. When I create a new index of only a, it does use the index. Why is that? And, more importantly, when I do a query involving a merge join of table t, which requires sorti

Re: [GENERAL] SORT and Merge Join via Index

2013-08-13 Thread Robert James
On 8/13/13, Robert James wrote: > I noticed that when I have an index on (a,b) of table t, and I do an > SELECT * FROM t ORDER BY a ASC, it doesn't use the index. When I > create a new index of only a, it does use the index. Why is that? > > And, more importantly, when I do

Re: [GENERAL] What type of index do I need for this JOIN?

2013-08-13 Thread Robert James
On 8/13/13, Craig Ringer wrote: > On 08/14/2013 06:05 AM, Robert James wrote: >> I'm doing a JOIN which is very slow: >> >> JOIN t ON t.f1 LIKE (q.f1 || '%') >> >> t1 has an INDEX on (f1, f2) which I thought would help for this. But >> Postgr

Re: [GENERAL] What type of index do I need for this JOIN?

2013-08-14 Thread Robert James
On 8/14/13, Kevin Grittner wrote: > Robert James wrote: > >> I'm confused: What's the difference between >> col LIKE 'foo%' >> and >> col LIKE f1 || '%' >> ? > > The planner knows that 'foo%' doesn'

[GENERAL] Escape string for LIKE op

2013-08-15 Thread Robert James
How can I escape a string for LIKE operations? I want to do: SELECT * FROM t WHERE a LIKE b || '%' But I want be to interpreted literally. If b is 'The 7% Solution', I don't want that '%' to be wildcard. I can't find an appropriate function to escape it and any other potential wildcards for LI

Re: [GENERAL] Escape string for LIKE op

2013-08-15 Thread Robert James
On 8/15/13, Jeff Janes wrote: > On Thu, Aug 15, 2013 at 1:16 PM, Robert James > wrote: >> How can I escape a string for LIKE operations? >> >> I want to do: >> >> SELECT * FROM t WHERE a LIKE b || '%' >> >> But I want be to interpreted l

[GENERAL] Forcing materialize in the planner

2013-08-15 Thread Robert James
I have a query which, when I materialize by hand some of its components, runs 10x faster (including the time needed to materialize). Is there any way to force Postgres to do that? Or do I need to do this by hand using temp tables? -- Sent via pgsql-general mailing list (pgsql-general@postgresql

[GENERAL] Using an index to materialize a function

2013-08-16 Thread Robert James
If I have a slow_function(), and I create an index of slow_function(field), will Postgres use that index to avoid having to recompute the function? Example: SELECT slow_function(field1) FROM table1 WHERE id = 5 It won't use the index on field1 to _find_ the record. Can it use it to compute the

[GENERAL] Does string a begin with string b?

2013-08-16 Thread Robert James
What's the best way to check if string a begins with string b? Both a and b are coming from fields in a table. Requirements: * Either a or b might have special chars (such as '%') in them which should NOT do anything special - they're just plain strings, not regular expressions. * a and b can be

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