Re: [GENERAL] Solved? Re: 8.2.4 signal 11 with large transaction

2007-07-20 Thread Andrew - Supernews
ulting from recursive errors... -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] Processing a work queue

2007-05-01 Thread Andrew - Supernews
On 2007-04-30, "John D. Burger" <[EMAIL PROTECTED]> wrote: > Andrew - Supernews wrote: > >>> Anyone have any ideas on how to handle a work queue? >> >> Advisory locks (userlocks in pre-8.2). > > Can someone explain why these are a better fit t

Re: [GENERAL] Processing a work queue

2007-04-28 Thread Andrew - Supernews
On 2007-04-26, Steve Crawford <[EMAIL PROTECTED]> wrote: > Anyone have any ideas on how to handle a work queue? Advisory locks (userlocks in pre-8.2). -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of

Re: [GENERAL] hashtext () and collisions

2007-04-11 Thread Andrew - Supernews
y bits_ in your hash value than you think you do. (e.g. using md5(), which is a 128-bit hash) -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [GENERAL] More grist for the PostgreSQL vs MySQL mill

2007-01-21 Thread Andrew - Supernews
On 2007-01-21, Ron Johnson <[EMAIL PROTECTED]> wrote: >> And no BDB (at least last I checked is not GPL) > > It's BSD (for obvious reasons), no? No, Sleepycat's licence is _NOT_ BSD. -- Andrew, Supernews http://www.supernews.com - individual

Re: [GENERAL] Aggregate in Correlated SubQuery

2006-10-15 Thread Andrew - Supernews
7;s rows, not over the outer query. (Though there are ways to do this query without the subquery at all) -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 3: Have you che

Re: [GENERAL] more anti-postgresql FUD

2006-10-13 Thread Andrew - Supernews
test should not be related to fsyncs, and this does not seem to > explain the huge discrepancy between update (1,000/sec) and insert > (9,000 inserts/sec, also in 1-sec txns) performance. Update has to locate the one live row version amongst all the dead ones; insert doesn't need to bother

Re: [GENERAL] more anti-postgresql FUD

2006-10-13 Thread Andrew - Supernews
On 2006-10-13, Alexander Staubo <[EMAIL PROTECTED]> wrote: > On Oct 13, 2006, at 17:13 , Andrew - Supernews wrote: >> Your disk probably has write caching enabled. A 10krpm disk should be >> limiting you to under 170 transactions/sec with a single connection >> and fsyn

Re: [GENERAL] more anti-postgresql FUD

2006-10-13 Thread Andrew - Supernews
tive at keeping the table size stable (at 70-odd pages) when running several hundred thousand updates on a 1-row table. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] looping through query to update column

2006-10-13 Thread Andrew - Supernews
For a one-off update, use a temporary sequence: create temporary sequence foo; update table set recordid = nextval('foo'); -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TI

Re: [GENERAL] Need help with a function from hell..

2006-10-03 Thread Andrew - Supernews
;, 'foo:baz']),','); array_to_string -- baz:quux,foo:bar/baz (1 row) To understand the function, look at the subqueries from the inside out; the inner one splits the foo:bar elements into two columns, groups by the first and collects t

Re: [GENERAL] Initializing Datums for use with SPI_execute_plan

2006-09-18 Thread Andrew - Supernews
On 2006-09-18, "Jack Orenstein" <[EMAIL PROTECTED]> wrote: > On 9/14/06, Andrew - Supernews <[EMAIL PROTECTED]> wrote: >> One way: > > Thank you, I hope you can help with some clarifications. > >> >> bytea *my_bytea = (bytea *) palloc(byte_a

Re: [GENERAL] ECPG: non-integer constant in group by

2006-09-15 Thread Andrew - Supernews
e it with "" if needed) rather than use a parameter for it. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate

Re: [GENERAL] Initializing Datums for use with SPI_execute_plan

2006-09-14 Thread Andrew - Supernews
byte_array_len + VARHDRSZ; values[0] = DirectFunctionCall1(textin,CStringGetDatum(yourstring)); values[1] = PointerGetDatum(my_bytea); SPI_execute_plan... -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast

Re: [GENERAL] Template1 oops

2006-09-13 Thread Andrew - Supernews
s :) Some of the few things that pg can _not_ do inside a transaction include: CREATE DATABASE DROP DATABASE -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 9: In versions below

Re: [GENERAL] Having problems with a 25 million row table on 8.1.3

2006-04-25 Thread Andrew - Supernews
ax_code from warehouse.sec_trans group by tax_code; Both of the DISTINCT variants rely on sorting. GROUP BY, on the other hand, can use a hash aggregate, which will be much more efficient where the number of distinct values is low. Of course it will still need to scan the whole table... -- Andrew, S

Re: [GENERAL] How to avoid empty temp schemas

2006-04-24 Thread Andrew - Supernews
nnection ends. In the event of a crash, they are cleared out when the temp schema is next recycled. > Is it safe to remove those schemas ? It is not necessary. I do not know if it is safe. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services --

Re: [GENERAL] IDT timezone

2006-04-22 Thread Andrew - Supernews
ably up to date - pg 8.0 onwards carry their own copy of the standard zoneinfo database with them). Zone names like 'IST' are in any event entirely ambiguous and should never be used - you could regard it as a pure fluke that pg happens to resolve 'IST' as +0200 rather than +0530...

Re: [GENERAL] Unexplained lock creating table

2006-04-22 Thread Andrew - Supernews
ll connections. relhassubclass isn't reset to false when all child tables of a parent table are removed. So next time through there is no need to update the pg_class row for the parent table. So the simplest workaround is probably to ensure that you create at least one partition in each ta

Re: [GENERAL] Replacing MD5 hash in pg_auth...

2006-04-17 Thread Andrew - Supernews
to own the DB? It's worse than that. If you can _read_ pg_auth, then you can log in as any user who has an MD5 password provided that pg_hba.conf allows md5 auth - the values stored in pg_auth (and pg_shadow) are password equivalents for the purposes of md5 auth. -- Andrew, Supernews

Re: [GENERAL] pg_restore 7.4.7 locks itself out

2006-04-10 Thread Andrew - Supernews
ng glacial, because (unless it's a text dump and you edited in BEGIN/COMMIT statements yourself) it'll be committing each row individually, which limits the restore speed to a couple of hundred rows/sec unless you have evil (or battery-backed) write caching or you've turned fsync

Re: [GENERAL] Non-Overlaping date interval index

2006-02-18 Thread Andrew - Supernews
the table. > > You can write a trigger to check the count of records which overlaps > (start,end): Doesn't work reliably due to the race condition, unless you lock the table against conflicting inserts. The problem of course is that the trigger doesn't see uncommitted ro

Re: [GENERAL] Multiple-index optimization not working for = ANY operator

2006-02-15 Thread Andrew - Supernews
n foo.id as the inner path. Execution times for 8.1 are usually very slightly worse than the equivalent IN (a,b,c,...) with literal values, but the plan time is shorter. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broa

Re: [GENERAL] update with subquery - unexpected results

2006-02-05 Thread Andrew - Supernews
orrelated, and returns true for all non-null values of v1 as long as t2 has at least one row. > update t1 set v1=4 where v1 IN (select NULLIF(1,1) from t2); v1 IN (NULL) is null for all v1, and WHERE treats null conditions as false. -- Andrew, Supernews http://www.supernews.com - ind

Re: [GENERAL] 8.0.3 regexp_replace()...

2006-02-02 Thread Andrew - Supernews
set null in psql to see the difference.) > Not without creating your own CAST. Casting from what? NULL isn't a type... > Seems to me that an obvious value would be 'NULL'. Or maybe '' > (empty string). If NULL ever got converted to 'NULL' or ''

Re: [GENERAL] NOT HAVING clause?

2006-01-24 Thread Andrew - Supernews
e bool_and() or every() in the usual way as a custom aggregate even on versions that don't have them builtin. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] SELECT Rules or stored procedure

2006-01-20 Thread Andrew - Supernews
put such a rule on a plain table, you will find that the table changes into a view.) -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] sort character data in arbitrary order?

2006-01-14 Thread Andrew - Supernews
do this all within the single query. If there's only a small number of possible "state" values then: ORDER BY state = 'a' DESC, state = 'b' DESC, state = 'c' DESC If there's more than a small number, then have a separate state_priority table map

Re: [GENERAL] Error when inserting millions of records

2006-01-14 Thread Andrew - Supernews
: Do you have any constraints, especially deferred constraints, or triggers on the table? Are there any functional indexes? -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 1: if posti

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Andrew - Supernews
get the same effect. (A primary key constraint is just a unique constraint that is also not null, and is the default target for REFERENCES constraints referring to the table - this last factor is why there can be only one...) -- Andrew, Supernews http://www.supernews.com - individual and

Re: [GENERAL] When it is better to use "timestamp without time zone"?

2006-01-04 Thread Andrew - Supernews
hat the result say "10:01:01" regardless of what timezone the client is in, then you want timestamp without time zone. If what matters is that the result be the _same time_ regardless of what timezone, then you want timestamp _with_ time zone. The second case is vastly more common. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] When it is better to use "timestamp without time zone"?

2006-01-04 Thread Andrew - Supernews
hich covers most uses of timestamps.) Only use timestamp without time zone for data storage if you have a specific reason to do so. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 9:

Re: [GENERAL] POSTGRES DB 3 800 000 rows table, speed up?

2006-01-03 Thread Andrew - Supernews
; and get answer after 3-10 seconds, is there a way to speed it up somehow? > any tweaks and tuneups possible with it? http://pgfoundry.org/projects/ip4r Designed specifically for storing IP ranges as in your example, it will (if correctly used) reduce that query time down to a few

Re: [GENERAL] INSERT OR UPDATE

2006-01-02 Thread Andrew - Supernews
n 8.0 on, use the method described here: http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)---

Re: [GENERAL] Best practices: Handling Daylight-saving time

2005-03-11 Thread Andrew - Supernews
99358864294 13:00:00 | 216.020873214721 14:00:00 | 224.915845037786 15:00:00 | 233.605042562575 16:00:00 | 242.016703682664 17:00:00 | 250.081358401684 18:00:00 | 257.732402570221 19:00:00 | 264.906647954345 20:00:00 | 271.544844092858 21:00:00 | 277.592167633387 22:00:00 | 282.99867510

Re: [GENERAL] Index scan vs. Seq scan on timestamps

2004-12-06 Thread Andrew - Supernews
On 2004-12-07, Stephen Frost <[EMAIL PROTECTED]> wrote: > Is there a way to say "just take the value of this function at the start > of the transaction and then have it be constant" in a query? Why not use CURRENT_TIMESTAMP, etc., which do exactly that? --

Re: [GENERAL] Index scan vs. Seq scan on timestamps

2004-12-06 Thread Andrew - Supernews
e world). Your column is of type "timestamp with time zone" (correct). The relationship between the two is not trivial and the lack of an index scan therefore expected. Try casting to "timestamp with time zone" instead. -- Andrew, Supernews http://www.su

Re: [GENERAL] select single entry and its neighbours using direct-acess to index?

2004-12-06 Thread Andrew - Supernews
BY > name,name2 DESC LIMIT 1; That needs to be ORDER BY name DESC, name2 DESC (the direction indicator applies per-column and not to the output ordering). Same goes for the WHERE clause in this query as the previous one, too. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Constaints

2004-12-05 Thread Andrew - Supernews
an fake session variables by using constant-returning functions defined in the per-session temporary namespace. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Upcoming Changes to News Server ...

2004-11-24 Thread Andrew - Supernews
On 2004-11-24, Marc G Fournier From : <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Andrew - Supernews) writes: >>Any chance of there being regular (or even only occasional) signed >>checkgroups messages for the new hierarchy? > > Sure, but I've never do

Re: [GENERAL] Upcoming Changes to News Server ...

2004-11-24 Thread Andrew - Supernews
g RFDd > right now pass, ppl are going to continue screaming that the other 15-16 > should be removed as well ... this way, thos using news.postgresql.org can > still get access to the whole hierarchy, while the comp.* would only carry > those that are deemed "official

Re: [GENERAL] RFD: comp.databases.postgresql.general

2004-11-08 Thread Andrew - Supernews
ws.groups from your replies. He's posting to the mailing list; he probably can't avoid dropping the crosspost. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]