[SQL] keeping last 30 entries of a log table

2006-06-16 Thread Jeff Frost
elect id from log where account_id = 1 order by timestamp desc limit 30); I'm wondering if there is a more performance oriented method of doing the delete that I'm not thinking of. -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingll

Re: [SQL] keeping last 30 entries of a log table

2006-06-19 Thread Jeff Frost
#x27;s no way to get around the subselect though. -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] keeping last 30 entries of a log table

2006-06-20 Thread Jeff Frost
27;t be too bad. -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will

Re: [SQL] keeping last 30 entries of a log table

2006-06-21 Thread Jeff Frost
last 30 items per each account_id...so each account_id will have his last 30 messages in the table. -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadc

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

2006-07-27 Thread Jeff Frost
one who set up this box and there has been virtually no administration or maintenance on it that I know of...) How about the WAL files in pg_xlog? How critical are they when no data on the system is critical in and of itself? Any suggestions would be greatly appreciated... -- Je

Re: [SQL] PostgreSQL server terminated by signal 11

2006-07-27 Thread Jeff Frost
terminated: Daniel, I would guess this is more appropriate for the -admin list so I cc'd it. I think you are most likely running out of memory or running up against a ulimit on memory. I would first check my ulimit settings on the postgres user and see if they are a bit small. -- Jeff

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

2006-07-27 Thread Jeff Frost
up on filesystem maintenance/tweaking... Scott Marlowe wrote: I can't tell you the number of times that little trick has saved my life. On Thu, 2006-07-27 at 11:32, Jeff Frost wrote: You can probably just "tune2fs -m 0 " to give yourself enough space to get out of the jam before yo

[SQL] DELETE WHERE EXISTS unexpected results

2010-11-30 Thread Jeff Bland
I want to delete certain rows from table USER_TBL. Two tables are involved. USER_TBL and OWNER_TBL. The entries that match BLAND type in OWNER table and who also have a matching entry in USER table NAME but only for USER_TBL entries with places equal to HOME. DELETE FROM SP.TST_USER_TBL WH

Re: [SQL] DELETE WHERE EXISTS unexpected results

2010-12-01 Thread Jeff Bland
The second example you gave worked for me. Thanks Carla ! D. Jeff Bland z/OS System House Installation and Packaging (zSHIP) BLAND at IBMUS bl...@us.ibm.com http://w3.pok.ibm.com/zos/i95a/ 845-435-42108/295-4210 Famous quote: Beauty is in the eye of the beer holder. From: Carla To

[SQL] delete and select with IN clause issues

2006-11-02 Thread Jeff Frost
;page_view_visit_idx" btree (visit_id) Foreign-key constraints: "fk34afd255fbacabec" FOREIGN KEY (visit_id) REFERENCES visit(id) What kind of silliness am I forgetting? -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] delete and select with IN clause issues

2006-11-02 Thread Jeff Frost
On Thu, 2 Nov 2006, Jeff Frost wrote: I'm having problem with a cleanup script that runs nightly. The script calls the following query: delete from visit where id not in (select distinct visit_id from page_view); This yields the following error: ERROR: update or delete on "visit

Re: [SQL] delete and select with IN clause issues

2006-11-02 Thread Jeff Frost
On Thu, 2 Nov 2006, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: delete from visit where id not in (select distinct visit_id from page_view); This yields the following error: ERROR: update or delete on "visit" violates foreign key constraint "fk34afd255fb

Re: [SQL] delete and select with IN clause issues

2006-11-02 Thread Jeff Frost
On Fri, 3 Nov 2006, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: On Thu, 2 Nov 2006, Tom Lane wrote: This seems pretty darn weird. I am wondering about corrupt indexes --- can you find the indicated key in either table if you set enable_indexscan and enable_bitmapsca

Re: [SQL] delete and select with IN clause issues

2006-11-02 Thread Jeff Frost
On Fri, 3 Nov 2006, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: BTW, just to make sure I get the right file to ship over if we have this again, it would be: /var/lib/pgsql/data/base/9366228/16204210 yes? Not necessarily --- the filename is initially the same as the index OI

Re: [SQL] delete and select with IN clause issues

2006-11-03 Thread Jeff Frost
On Fri, 3 Nov 2006, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: Well, I spoke to soon on the it all works front. So, it's been reindexed and appears to be working properly now. I guess I'll keep an eye on it for a while. I didn't get your query suggestion in

Re: [SQL] delete and select with IN clause issues

2006-11-07 Thread Jeff Frost
rring, but it's possible the index was already damaged? -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadcast)--- TIP 3

Re: [SQL] delete and select with IN clause issues

2006-11-08 Thread Jeff Frost
On Tue, 7 Nov 2006, Jeff Frost wrote: Well, it's been working wonderfully since the REINDEX, so I don't know what to say. Any idea if having a too small max_fsm_pages could hose an index, because I know that happened not too long before we started seeing this problem. The fsm set

[SQL] consistent random order

2006-11-29 Thread Jeff Herrin
random set. That way, when I get to the 2nd page, i know i'm getting the dataset back in the same order that I had on page 1, and the offset works like normal. Is this even realistically possible? Thanks, Jeff Herrin

Re: [SQL] consistent random order

2006-11-29 Thread Jeff Herrin
I need it a little more random than that. In both these scenarios, the same items will always follow each other. Jeff - Original Message - Why not create a random seed between 1 and the number of possibilities in your web application when a user first hits the site, store that in

Re: [SQL] consistent random order

2006-11-29 Thread Jeff Herrin
I don't think cursors are going to help in this case. The order by random() is still going to give different result sets on different pages. Jeff - Original Message - From: Andreas Kretschmer <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Sent: Wednesday, November 29, 2006

Re: [SQL] consistent random order

2006-11-30 Thread Jeff Herrin
Michael, I think you may have solved my problem. We're still experimenting with it but I think setseed is going to work. Thank you very, very much! Jeff Herrin - Original Message - From: Michael Fuhr <[EMAIL PROTECTED]> To: Jeff Herrin <[EMAIL PROTECTED]> Cc: Andreas K

Re: [SQL] hi any one can help me

2006-12-03 Thread Jeff Lu
You will need to manually remove the postgresql folder under Program files because uninstalling does not remove that folder for you. - Original Message From: Penchalaiah P. <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Sent: Sunday, December 3, 2006 5:33:41 AM Subject: [SQL] hi any o

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
e row returned by a subquery used as an expression Thanks Richard ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
Perhaps I should have asked this earlier. What information are you trying to extract? On Mon, 22 Jan 2007, Richard Ray wrote: This is not exactly what I need I want to return the data in t1 On Mon, 22 Jan 2007, Jeff Frost wrote: I think this is what you're looking for Richard: S

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
pg_class where relname = 't1') and attisdropped = false and attnum > 0) is a substitute for * On Mon, 22 Jan 2007, Jeff Frost wrote: Perhaps I should have asked this earlier. What information are you trying to extract? On Mon, 22 Jan 2007, Richard Ray wrote: This is not exactly what

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
On Mon, 22 Jan 2007, Richard Ray wrote: On Mon, 22 Jan 2007, Jeff Frost wrote: So why are you avoiding "SELECT * FROM t1;" ? I was affeared that if I brought my total ignorance to light I would be band from the list but here goes. I work in UNIX/Linux environments. It's my

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
On Tue, 23 Jan 2007, Josh Williams wrote: From: Jeff Frost <[EMAIL PROTECTED]> On Mon, 22 Jan 2007, Richard Ray wrote: ... That's definitely part of it. I'm assuming the above is an abridged example and the OP is doing something dynamic with the query. The real trouble i

[SQL] Nocount and scope_identity()

2007-02-02 Thread Demel, Jeff
o, I'm wondering if NOCOUNT is supported in Postgres at all. If it's not, what's the alternative? If it is, what is wrong with my syntax? I haven't gotten there yet, but I'm also wondering if the SCOPE_IDENTITY() method is going to work or not. TIA -Jeff This email is in

Re: [SQL] Nocount and scope_identity()

2007-02-02 Thread Demel, Jeff
t; I haven't gotten there yet, but I'm also wondering if the > SCOPE_IDENTITY() method is going to work or not. I doubt it. What does it do? It returns the id of the record just inserted. -Jeff This email is intended only for the individual or entity to which it is addressed.

[SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Microsoft SQL server has two extended stored procedures that I need in Postgres: xp_nysiis and xp_metaphone. They do fuzzy matching on strings. Are there Postgres alternatives for these? Or maybe some other way to do phonetic/fuzzy matching that would be as effective? -Jeff -Original

Re: [SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Ah! Cool. Contrib/fuzzystrmatch has metaphone. Looks like it has soundex and levenschtein too. Thanks! -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 2:09 PM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] metaphone and

Re: [SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Can this be installed easily on Windows? -Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Demel, Jeff Sent: Wednesday, February 07, 2007 2:13 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] metaphone and nysiis in postgres Ah! Cool. Contrib

Re: [SQL] metaphone and nysiis in postgres

2007-02-08 Thread Demel, Jeff
;t have to juggle users, permissions, and settings. -Jeff -Original Message- From: Richard Huxton [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 3:06 AM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] metaphone and nysiis in postgres Demel, Jeff wrote: >

[SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
LIMITER AS ' ', forcevalue1 = 1, forcevalue2 = 'this value' ; TIA -Jeff This email is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential or otherwise protected from disclosure. Dissem

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
That works like a charm. Thanks, Alvaro! -Jeff -Original Message- From: Alvaro Herrera [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 1:22 PM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY FROM - force a value Demel, Jeff wrote: > Is there a way

[SQL] separating improperly grouped page views

2007-06-17 Thread Jeff Frost
explain analyze output yet. Does anyone have a better method of separating this data out? --- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(end of broadcast)

Re: [SQL] separating improperly grouped page views

2007-06-17 Thread Jeff Frost
On Mon, 18 Jun 2007, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: [ umpteen million iterations of: ] -> Limit (cost=0.00..367.09 rows=1 width=8) -> Index Scan Backward using page_view_stamp_idx on page_view pv2 (cost=0.00..158215

Re: [SQL] separating improperly grouped page views

2007-06-19 Thread Jeff Frost
On Sun, 17 Jun 2007, Jeff Frost wrote: - Seq Scan on page_view pv1 (cost=0.00..11529031.34 rows=3580205 width=239) SubPlan -> Result (cost=1.58..1.59 r

Re: [SQL] separating improperly grouped page views

2007-07-05 Thread Jeff Frost
On Sun, 17 Jun 2007, Jeff Frost wrote: On Mon, 18 Jun 2007, Tom Lane wrote: Jeff Frost <[EMAIL PROTECTED]> writes: [ umpteen million iterations of: ] -> Limit (cost=0.00..367.09 rows=1 width=8) -> Index Scan Backward using page_view_

[SQL] Why does the sequence skip a number with generate_series?

2007-10-03 Thread Jeff Frost
doesn't hurt anything, I'm just curious why it skips one after every generate_series insert? -- Jeff Frost, Owner <[EMAIL PROTECTED]> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 ---(

[SQL] DBLink or setof record functions & type shortcuts

2007-12-19 Thread Jeff Trout
('select * from someFooTypeReturningFunc()') as t1(col text, ) I could write select * from dblink('select ... ') as t1(footype) I've poked over the docs and googled around, haven't seen anything yet. -- Jeff Trout <[EMAIL PROTECTED]> http:/

[SQL] finding columns that have three or fewer distinct characters

2008-03-05 Thread Jeff Frost
thing to do would be to lowercase everything, then remove all duplicate chars and spaces, then use length() on that, but it's not obvious to me how I might remove the duplicate chars with the pattern matching support in the docs. -- Jeff Frost, Owner <[EMAIL PROTECTED]&g

Re: [SQL] finding columns that have three or fewer distinct characters

2008-03-05 Thread Jeff Frost
On Wed, 5 Mar 2008, Osvaldo Rosario Kussama wrote: Jeff Frost escreveu: I've got an interesting one...I'm trying to find columns that have three or fewer distinct characters (for example, "aa"). Wondering if I need to write a function or if someone has an idea how

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-22 Thread Jeff Williams
INNER JOIN Orders O ON C.CustomID=O.CustomID WHERE C.Name LIKE '%' || input || '%'; RETURN $1; END $$ LANGUAGE plpgsql; Then to use: BEGIN; SELECT test('curs', ); FETCH ALL FROM curs; END; Jeff -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Use of index in 7.0 vs 6.5

2000-05-25 Thread Jeff Hoffmann
about cost estimates, but i can't remember seeing a list of them documented anywhere -- i've just stumbled onto them, more or less. jeff

[SQL] 7.0 weirdness

2000-05-30 Thread Jeff MacDonald
#x27;%Marriage%' gm-> OR wantrstypemale like '%Long Term%' gm-> OR wantrstypemale like '%Penpal%' gm-> OR wantrstypemale like '%Activity Partner%') gm-> ) order by created desc; ERROR: For SELECT DISTINCT, ORDER BY expressions must appear in target list gm=> any idea's ? jeff

RE: [SQL] 7.0 weirdness

2000-05-30 Thread Jeff MacDonald
gid is unique.. jeff On Tue, 30 May 2000, Patrick FICHE wrote: > It seems to me that it was lack of control in 6.5 version... > For one "gid", you may have several "created" values, so Postgres is not > able to decide which value must be taken and orde

Re: [SQL] 7.0 weirdness

2000-05-30 Thread Jeff MacDonald
gid is unique.. it's a serial.. funny thing is tho this worked on 6.5 oh well thanks for the info. jeff On Tue, 30 May 2000, omid omoomi wrote: > Hi jeff, > I'm not sure but may be that's because you are using select distinct and so > there would be a few rows with

Re: [HACKERS] Re: [SQL] 7.0 weirdness

2000-05-31 Thread Jeff MacDonald
thanks for the hlep guys.. for those that are curious, the distinct is tehr cause it's someone elses code that i'm workig on .. :) have to kick out the bug's// jeff On Tue, 30 May 2000, Matthias Urlichs wrote: > Hi, > > Jeff MacDonald: > > gid is unique.. it

Re: [SQL] Default timestamp value

2000-06-05 Thread Jeff Hoffmann
(f1 int, f2 timestamp default 'now'::datetime); create table foo (f1 int, f2 timestamp default 'now'::timestamp); it will give you the time that the table was created. it's just a little gotcha that might frustrate people in a similar situation. jeff

[SQL] timespan casting

2000-06-22 Thread Jeff MacDonald
can do a select so it says something more human usable ie : 100 days 22 hours 32 minutes.. jeff

Re: [SQL] Merging two columns into one

2000-06-23 Thread Jeff Hoffmann
e you want on it if you want to reuse it. the files located at: http://www.potlatch.org/source/phone.tar.gz -- Jeff Hoffmann PropertyKey.com

[SQL] query failed , don't know why

2000-06-23 Thread Jeff MacDonald
i'm running postgresql 7.0.2 with freebsd 4.0 stable jeff

<    1   2   3