[SQL] Schema partitioning

2011-09-01 Thread Charlie
Could I get feedback from the community on schema partitioning? I'm doing maintenance on my ddl and I'm noticing that my tables are all in 1 schema, but they have prefixes on their names like table_app1_sometable, table_app1_secondtable,  table_app2_anothertable, table_priviledged_restrictedtab

Re: [SQL] Calculating relative time/distance from CURRENT_TIMESTAMP

2011-08-04 Thread Charlie
Consider: SELECT (NOW() - '1-Aug-2011')::text || ' ago.' user_string; yields: "3 days 18:59:24.781174 ago." From: gna...@zoniac.com To: amitabhk...@gmail.com CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Calculating relative time/distance from CURRENT_TIMESTAMP Date: Thu, 4 Aug 2011 17:12:51 +

[SQL] Re: [SQL] Help with regexp-query

2011-08-02 Thread Charlie
select id, regexp_replace(category, (E'\\|{2,}'), E'\|', 'g') as category from akb_articles limit 100 Backslash in regex doubled. Added global modifier to replace all occurrences. - Reply message - From: "Johann Spies" Date: Thu, Jul 28, 2011 8:20 am Subject: [SQL] Help with regexp-quer

[SQL] Re: [SQL] How to remove a set of characters in text-columns ?

2011-06-30 Thread Charlie
Would regexp_replace(src_str, '[\{\}\[\]\(\)\.', '') at http://www.postgresql.org/docs/9.0/static/functions-string.html help? - Reply message - From: "Andreas" Date: Thu, Jun 30, 2011 4:28 pm Subject: [SQL] How to remove a set of characters in text-columns ? To: Hi, how can I re

[SQL] Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Charlie
WITH foo AS (  SELECT column1::integer id, column2::timestamp ts  FROM (VALUES    (0, '1-Jan-2010 20:00'),    (1, '1-Jan-2010 20:03'),    (1, '1-Jan-2010 20:04'),    (0, '1-Jan-2010 20:05'),    (1, '1-Jan-2010 20:05'),    (0, '1-Jan-2010 20:08'),    (1, '1-Jan-2010 20:09'),    (0, '1-Jan-

[SQL] Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Charlie
SELECT a.* FROM foo a INNER JOIN foo b ON b.id = a.id AND b.ts >= a.ts + '5 minutes' GROUP BY a.id, a.ts ORDER BY a.id, a.ts Not clear yet on the needs, but this may give a start. - Reply message - From: lists-pg...@useunix.net Date: Sat, Jun 4, 2011 4:15 pm Subject: [SQL] selecti

[SQL] Re: [SQL] extracting location info from string

2011-05-25 Thread Charlie
Have you looked at http://en.m.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance - Reply message - From: "Tarlika Elisabeth Schmitz" Date: Wed, May 25, 2011 6:13 pm Subject: [SQL] extracting location info from string To: On Wed, 25 May 2011 09:25:48 -0600 Rob Sargent wrote:

[SQL] Re: [SQL] Sorting data based fields in two linked tables

2011-05-14 Thread Charlie
SELECT A.ID,A.FIELD1,A.FIELD2,  B.FIELD1,B.FIELD2, B.FIELD1,B.FIELD2, B.FIELD1,B.FIELD2 FROM a INNER JOIN B ON a.id = b.a_id ORDER BY a.field2 ASC, b.field1 ASC ; - Reply message - From: "R. Smith" Date: Fri, May 13, 2011 12:00 pm Subject: [SQL] Sorting data based fields in two linked

[SQL] Re: [SQL] Select and merge rows?

2011-05-05 Thread Charlie
While there is insufficient information provided (a couple of table snippets), you may consider and experiment with the snippet below to get you started. SELECT ids.id, f1.value AS value1, f2.value AS value2, f3.value AS value3 FROM ( SELECT DISTINCT id FROM foo ) AS ids LEFT JOIN foo

Re: [SQL] help on select

2011-04-21 Thread Charlie
You might try: WITH pontos AS ( SELECT column1 AS idponto FROM (VALUES (10), (11), (23), (24) ) AS a ), subset AS ( SELECT b.idponto, date_trunc('day', datetime) AS datetime FROM medidas b INNER JOIN pontos USING(idponto) GROUP BY b.idponto, date_trunc('day', da

[SQL] Re: [SQL] unnesting of array of different size explodes memory

2011-04-13 Thread Charlie
structure encoded in the function, and so starts from scratch each time - very slow. I got my function times from 10 secs to 300 ms by assembling query strings in the function. Charlie - Reply message - From: "Andreas Gaab" Date: Wed, Apr 13, 2011 6:15 am Subject: [SQL] unnestin

Re: [SQL] Disk is full, what's cool to get rid of?

2006-07-27 Thread Wilkinson Charlie E
Won't help some of us, who set -m 0 on selected filesystems to begin with. But if we could get tune2fs -m -5 to work, then we could unreserve space that didn't previously exist. Think of the possibilties! I'll look into that as soon as I'm done modding my C compiler to handle the --force option

[SQL] Problem with JOINS

2004-05-21 Thread Charlie Clark
gt; Seq Scan on bill_status_list bs (cost=0.00..1.10 rows=2 width=15) Filter: ((value = 'erlassen'::character varying) OR (value = 'bezahlt'::character varying)) What I notice is that in the second query the following filter is missing. -> Hash (cost=14.77..14.77 rows=1 width=120) -> Seq Scan on address (cost=0.00..14.77 rows=1 width=120) Filter: (ltrim(lower((ort)::text)) ~~ 'neuss%'::text) I'm going to try and break this down and work through it myself but would be very grateful for any pointers. Thanks Charlie Clark ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

[SQL] schema-qualified permission problem

2003-05-29 Thread Charlie Toohey
Why can't my primary user (ttvuser) access tables (owned by owneruser) for which they've been granted access? I can describe the table, but can't read it. === Here's what I'm getting: ttvdev=> \c - owneruser Password: You are now connected as new user owneruser. ttvdev=> \d

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
iving your message, I posted a reply basically asking how currval would work if there were concurrent updates --- please ignore that response. thanks everyone --- I now feel "empowered" to carry on with my project On Thursday 13 June 2002 03:01 pm, Jason Earl wrote: > Charlie T

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
quence may have been incremented by another session ? On Thursday 13 June 2002 02:06 pm, Stephan Szabo wrote: > On Thu, 13 Jun 2002, Charlie Toohey wrote: > > I'm having a problem and there seems to be 2 solutions. It is simple and > > straighforward, but will take several paragra

[SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
the same table constantly -- I would only be writing to it, and, I would guarantee that I would be using the correct id in both master and detail without have to SET TRANSACTION ISOLATION LEVEL SERIALIZEABLE. Any comments on which solution you would choose, or is there a better solution ?

[SQL] VACUUM VERBOSE ANALYZE locking up?? Please help!

2001-10-10 Thread Wilkinson Charlie E
4, MaxLen 2034; Re-using: Free/Avail. Space 5280/0; EndEmpty/Avail. Pages 0/0. CPU 0.01s/0.00u sec. NOTICE:  Index pg_toast_17058_idx: Pages 2; Tuples 2: Deleted 0. CPU 0.00s/0.00u sec. [[[query stops here and will go no further]]] Any useful insights or solutions?  Pretty please?  :) Thanks f

RE: [SQL] List Concatination [warning]

2001-05-02 Thread Wilkinson Charlie E
Title: RE: [SQL] List Concatination [warning] A word of warning for the newbies... *Don't* create a function called textcat.  You *will* be sorry.  There's already a textcat builtin and you kinda need it for || and whatnot. (Yes, I found out the hard way...) There might be a better way to