[GENERAL] FK check will use index on referring table?

2008-07-24 Thread John D. Burger
sing on one delete). How can I tell what the trigger is doing? I'm using 8.2.5 and I've ANALYZED everything. Thanks. - John D. Burger MITRE -- 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] Need LIMIT and ORDER BY for UPDATE

2007-12-13 Thread John D. Burger
ing around such issues, anyway. - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Better alternative for Primary Key then serial??

2007-12-13 Thread John D. Burger
. It turned out that the natural keys were always positive, so I set up the sequence to range =downward= from 0. - John D. Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Need LIMIT and ORDER BY for UPDATE

2007-12-12 Thread John D. Burger
D. Dante Lorenso wrote: I'd really like to have ORDER BY and LIMIT for UPDATE and DELETE commands. Is this possible? UPDATE invoice i SET reserve_ts = NOW() + '1 hour'::timestamp FROM account a WHERE a.acct_id = i.acct_id AND i.reserve_ts < NOW() AND a.status = 'A' AND i.is_pai

Re: [GENERAL] top posting

2007-12-11 Thread John D. Burger
ot;Do you prefer the good x above, or the bad x below?". It's a fair cop (but society's to blame :). Sorry, I thought better of it right after I hit Send. - John D. Burger MITRE ---(end of broadcast)--- TIP 4: Have you search

Re: [GENERAL] top posting

2007-12-11 Thread John D. Burger
Quoting the text to which you are responding is often the only way to provide the necessary specific context for your comments. As an illustration, which helps you understand the preceding paragraph better, the extract above, or the mess below? - John D. Burger MITRE On Dec 11, 2007, at 11:54,

Re: [GENERAL] SQL design pattern for a delta trigger?

2007-12-08 Thread John D. Burger
So two design patterns for a makeshift UPSERT have been presented - one is to check beforehand, and only insert if the item isn't present already, the other is to do the insert blindly and let PG check for you, and catch any exceptions. I'm also wondering what people's ideas are for a sort

Re: [GENERAL] Array index not used for query on first element?

2007-12-07 Thread John D. Burger
Tom Lane wrote: It seemed reasonable to me that a select on the first element of an array column could use an index on the column, but, as seen in this example, I can't get it to do so: Nope. The operators that go along with a btree index are equality, less than, etc on the whole indexed colu

[GENERAL] Array index not used for query on first element?

2007-12-07 Thread John D. Burger
It seemed reasonable to me that a select on the first element of an array column could use an index on the column, but, as seen in this example, I can't get it to do so: => create temp table tempPaths (path int[] primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "

[GENERAL] How to EXPLAIN statements inside a trigger function?

2007-12-07 Thread John D. Burger
I'm developing some triggers for the first time, and I'm having trouble analyzing their performance. Does anyone have any advice for doing EXPLAIN and the like on statements involving NEW? For instance, I'd like to know what plan PG is coming up with for this fragment of a trigger functio

Re: [GENERAL] select random order by random

2007-11-02 Thread John D. Burger
lumn, despite its renaming. Contrast this with ... order by random; // plain column reference This substantially breaks the principle of least surprise for me. Caveat - this is on 7.4 (sigh), perhaps more modern versions have different behavior. - John D. Burger MITRE

Re: [GENERAL] Selecting K random rows - efficiently!

2007-10-25 Thread John D. Burger
As far as I can tell, all of the proposed solutions lack sample independence. Take the OP's suggested approach of doing something like this: SELECT * FROM mydata WHERE mydata.random_number >= (SELECT RANDOM() OFFSET 0) ORDER BY mydata.random_number ASC LIMIT 100 All you're doing is pi

[GENERAL] [OT] xkcd - A webcomic of romance, sarcasm, math, and language

2007-10-12 Thread John D. Burger
DB-related humor: http://xkcd.com/327/ - John D. Burger MITRE ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org/

Re: [GENERAL] <> ALL( ... ) and <> ANY ( ... ) didn't behave as expected

2007-10-10 Thread John D. Burger
Richard Broersma Jr wrote: Here is the example that doesn't do what I expect: --find all parents that have a mixture of boys and girls. --but this doesn't return anything SELECT * FROM Parents AS P WHERE 'girl' <> ALL ( SELECT gender FROM Children AS C1

Re: [GENERAL] Lifting WHERE conditions out of inner select

2007-10-09 Thread John D. Burger
the actual pulling would take some code that doesn't exist now, too, Okay, good to know. The situation is obviously easy to avoid, I just found the contrast surprising. Thanks. - John D. Burger MITRE ---(end of broadcast)--- TIP 1: if

[GENERAL] Lifting WHERE conditions out of inner select

2007-10-08 Thread John D. Burger
select results were the same in both cases, but I'm willing to believe that's an accident of our data. (Sorry if no one can answer my question without the table definitions, etc. - it seemed worthwhile trying to get away without that for now.) Thanks. - John D. Burger

Re: [GENERAL] access privileges: grant select on (all current and future tables)?

2007-09-28 Thread John D. Burger
rivileges to tables which do not yet exist, which I discovered in this thread: http://archives.postgresql.org/pgsql-general/2007-02/msg00911.php If you follow the thread, you'll find that one reply pointed to some existing functions for managing this stuff. I found these usef

Re: [GENERAL] Performance Issues (was: "like" vs "substring" again)

2007-09-18 Thread John D. Burger
tter plan. I don't know the details of your setup, but you can do things like this with any ordered type: where test between '11' and '113' or test >= '114' I know this does not match the exact semantics of your query, but hopefully you get the

Re: [GENERAL] Q:Aggregrating Weekly Production Data. How do you do it?

2007-09-18 Thread John D. Burger
e issues (but I have not looked closely at it). You can also see Wikipedia for one of the most well known, due to Knuth/Wellford: http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance - John D. Burger MITRE ---(end of broadcast)---

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-30 Thread John D. Burger
Tom Lane wrote: Anyway, there's no doubt that we can point to the behavior of MAX/MIN as defense for what we made GREATEST/LEAST do, so I'm inclined to leave their behavior alone, at least until such time as they're actually standardized. I don't think I buy this - MIN and MAX are aggregate

Re: [GENERAL] date time function

2007-06-29 Thread John D. Burger
nute - does this have to do with the varying number of days in different months? Thanks. - John D. Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Aggregates

2007-06-21 Thread John D. Burger
Richard Huxton wrote: Ah, but this just includes the time of the last message, not its data. Oops, I read the OP's question as "date and time", rather than "data and time". Nevermind. :) - John D. Burger MITRE ---

Re: [GENERAL] Aggregates

2007-06-21 Thread John D. Burger
er join message using (userid) group by userid, user.name, user.address; As to whether this is faster or prettier than a subquery, I dunno. - John D. Burger MITRE ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send

Re: [GENERAL] querying the age of a row

2007-06-07 Thread John D. Burger
Lonni J Friedman wrote: I have a need to determine which rows in a specific table are less than 24 hours old. I've tried (and failed) to do this with the age() function. And on the suggestion of a timestamp column with DEFAULT NOW(): Unfortunately, its too late now. The database (and its ta

Re: [GENERAL] Seq Scan

2007-06-01 Thread John D. Burger
Tyler Durden wrote: I'm having some problems in performance in a simple select count(id) from I have 700 000 records in one table, and when I do: # explain select (id) from table_name; -[ RECORD 1 ] QUERY PLAN | Seq Scan on t

Re: [GENERAL] Geographic data sources, queries and questions

2007-05-30 Thread John D. Burger
Even ISO country codes are not guaranteed to be stable I'm not sure where the idea that primary keys must be stable comes from. There's nothing necessarily wrong with updating a primary key. All a primary key does is uniquely identify a row in a table. If that id changes over time, that's

Re: [GENERAL] Geographic data sources, queries and questions

2007-05-29 Thread John D. Burger
standards. - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Geographic data sources, queries and questions

2007-05-28 Thread John D. Burger
he number of US "terms of sovereignty" that exist. Yah, that's my point - some data sources might lump all these together as state/province level entities, and some might not. - John D. Burger MITRE ---(end of broadcast)--- TIP 1: i

Re: [GENERAL] Geographic data sources, queries and questions

2007-05-28 Thread John D. Burger
same kind of goals we did. Anyway, I will send our schema under separate cover, and I will investigate sending you the data as well. - John D. Burger MITRE ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your

Re: [GENERAL] index vs. seq scan choice?

2007-05-25 Thread John D. Burger
tp://archives.postgresql.org/pgsql-general/2006-10/msg00526.php - John D. Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Geographic data sources, queries and questions

2007-05-24 Thread John D. Burger
, etc. As far as FIPS and ISO codes are concerned, we have a separate table mapping (locationID, standards body) to codes. We are interested in sharing this stuff, so I'd be happy to pass along the schema and/or the data, although all of it is kind of beta. - John D.

Re: [GENERAL] default db

2007-05-22 Thread John D. Burger
defaults you want. I gather that's the point of template0. See the Fine Manual: http://www.postgresql.org/docs/8.1/interactive/manage-ag- templatedbs.html - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget t

Re: [GENERAL] Fault Tolerant Postgresql (two machines, two postmasters, one disk array)

2007-05-17 Thread John D. Burger
Shoot The Other Node In The Head: http://www.linux-ha.org/STONITH - John D. Burger MITRE ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] cube operations

2007-05-16 Thread John D. Burger
ABHANG RANE wrote: I have a array column which has 12 real values in it. Basically these values represent co-ordinates in 12 dimensions for a substance. My main need is to find substances similar to a particular compound. Now I can do by calculating differences with each array in the whol

Re: [GENERAL] Performance issues of one vs. two split tables.

2007-05-15 Thread John D. Burger
s and pieces to read would be prohibitively slow. Moreover, caching only those bits and pieces would require complicated code to decide whether the cached data is relevant to the next query. Validating cached data at the page level is much simpler, and thus faster. Or so I assume ... -

Re: [GENERAL] Streaming large data into postgres [WORM like applications]

2007-05-14 Thread John D. Burger
ow often it's only the timestamp that changes, this could result in decent "compression". Of course, now you need referential integrity. - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Database transaction related

2007-05-14 Thread John D. Burger
there is a work request, and performs the work. This can be done by a periodic cron job, or using NOTIFY/LISTEN. There was a fairly detailed discussion of this last month - the thread starts here: http://archives.postgresql.org/pgsql-general/2007-04/msg01152.php - John D. Burg

Re: [GENERAL] Pattern Matching - Range of Letters

2007-05-10 Thread John D. Burger
g Regular expressions would work, but a between statement should work also. SELECT * FROM Your_table AS YT WHERE YT.text_field BETWEEN 'Aa' AND 'An'; Ron, in case it's not clear, if an index on text_field exists, the planner can use it to make such queries run re

Re: [GENERAL] Processing a work queue

2007-04-30 Thread John D. Burger
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 than whatever locks SELECT FOR UPDATE acquires? Thanks. - John D. Burger MITRE ---(end of

Re: [GENERAL] Temporal Units

2007-04-30 Thread John D. Burger
was a brief discussion of this just last week, with a few solutions suggested: http://archives.postgresql.org/pgsql-general/2007-04/msg01098.php - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free

Re: [GENERAL] Processing a work queue

2007-04-27 Thread John D. Burger
... ] That shouldn't happen. Look into pg_locks to see if you can determine who's waiting for what. I don't want to recreate the problem right now, but I will investigate later. For what it's worth, while the workers were locked up, I couldn't query the table i

Re: [GENERAL] Processing a work queue

2007-04-27 Thread John D. Burger
I wrote: I use a variant of The Tom Lane Solution previously pointed to, your Plan 1 is very similar. Hmm, per that pointed-to post: http://archives.postgresql.org/pgsql-general/2003-05/msg00351.php I decided to run a periodic vacuum on my work queue. Lo and behold, I get this: ERR

Re: [GENERAL] Processing a work queue

2007-04-26 Thread John D. Burger
Steve Crawford wrote: Anyone have any ideas on how to handle a work queue? I've been thinking about optimizing this process for quite a while. I use a variant of The Tom Lane Solution previously pointed to, your Plan 1 is very similar. This does not produce desirable results. In the case

Re: [GENERAL] DIfferent plans for explicit versus implicit join using link table

2007-04-26 Thread John D. Burger
Tom Lane replied: I have two queries for looking up related words which I think should be equivalent, but 7.4.8 comes up with very different plans. They're not at all equivalent: If there are duplicate word1id,word2id entries in allwordrelations, the first query will produce duplicate out

Re: [GENERAL] Business days

2007-04-26 Thread John D. Burger
quot;: http://www.sqlmag.com/Article/ArticleID/25899/sql_server_25899.html The big ugly union might need to be munged a bit, but most of the non- weekend US holidays seem to be there. - John D. Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

[GENERAL] DIfferent plans for explicit versus implicit join using link table

2007-04-26 Thread John D. Burger
Hi - I have a table of words and a table linking words in various ways: create table allWords ( wordIDserial PRIMARY KEY, word text ); create unique index ix_allwords_word ON allwords (word); create table allWordRelations ( word1ID integer references allWords, wo

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread John D. Burger
Andrew Edson wrote: I am aware of this, yes, but the data in question is all (both sets) contained on a single table. That's why I was looking for a way to do a 'dump where (select foo where bar = 'criteria')' structure. What if you do that select into a new table, then pg_dump just that

Re: [GENERAL] NEWBIE: How do I get the oldest date contained in 3 tables

2007-04-10 Thread John D. Burger
T min(datecol1) FROM table1 UNION ALL ... ) - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

[GENERAL] New to concurrency

2007-04-06 Thread John D. Burger
uation? Thanks for any advice. - John D. Burger MITRE ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through

Re: [GENERAL] COPY FROM - how to identify results?

2007-04-03 Thread John D. Burger
nextval() and sequences are not what I'm looking for. I want to assign the same id to all the rows imported from the same file. Let's say user A is working on portfolio_id 3, and decides to upload a spreadsheet with new values. I want to be able to import the spreadsheet into the staging ta

Re: [GENERAL] Deleted Flag/Unique Constraint

2007-03-29 Thread John D. Burger
Bryan Murphy wrote: I think the other guys suggestion will work better. ;) Good lord, yes. Dunno what I was thinking - I use partial indexes all the time, and I know a unique constraint is implemented with an index. Just got carried away, I guess. :) - John Burger MITRE

Re: [GENERAL] Deleted Flag/Unique Constraint

2007-03-29 Thread John D. Burger
On Mar 29, 2007, at 17:39, Bryan Murphy wrote: Is it possible to declare a unique constraint in combination with a deleted flag? For example, if I have a table like this: CREATE TABLE ( ID NOT NULL PRIMARY KEY, Key VARCHAR(32) NOT NULL, Value VARCHAR(32) NOT NULL, Deleted INT NOT NUL

Re: [GENERAL] Timestamp precision

2007-03-29 Thread John D. Burger
binary exchange of timestamps is complicated. What does libpq do now with timetamps, if the client requests data in binary form? How does the client know whether it's getting floats or integers? - John D. Burger MITRE ---(end of broadcast)-

Re: [GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread John D. Burger
for the pointers toward this solution. - John D. Burger MITRE ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

[GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread John D. Burger
under the covers, so my client doesn't spin up the cpu? (Yes, I know I could poll-sleep-poll-sleep - that's what I'll do if there's nothing cleaner.) - John D. Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] planning issue

2007-03-19 Thread John D. Burger
create a function lower index and instead of calling ilike call ~ lower('123') To clarify a little: CREATE INDEX table_a_lower_field_1_idx on table_a ((lower(field_1))); CREATE INDEX table_a_lower_field_2_idx on table_a ((lower(field_2))); SELECT * FROM table_a WHERE id

Fwd: [GENERAL] Native type for storing fractions (e.g 1/3)?

2007-03-15 Thread John D. Burger
rithms pretty easily. I haven't looked, but I would be surprised if there was much OOP in the rational code, it might be fairly trivial to "dumb it down" to C. - John D. Burger MITRE ---(end of broadcast)--- TIP 3: Have y

Re: [GENERAL] Native type for storing fractions (e.g 1/3)?

2007-03-15 Thread John D. Burger
brary that provides rationals, or model my code closely after one. - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Anticipatory privileges

2007-02-17 Thread John D. Burger
Tom Lane wrote: How dangerous is it to UPDATE pg_class directly, perhaps copying the relacl column for a table that I've done by hand with GRANT. You can do it, and it will seem to work. However, unless you also make entries in pg_shdepend, bad things will happen if you later drop any of

Re: [GENERAL] Anticipatory privileges

2007-02-17 Thread John D. Burger
Alvaro Herrera wrote: If I am reading the (7.4) docs correctly, privileges can be granted only with respect to tables that exist at the time the GRANT command is given Yes. In fact, I have to individually grant access to each table, and any associated sequences, yes? How dangerous is it

[GENERAL] Anticipatory privileges

2007-02-16 Thread John D. Burger
? Thanks. - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Recover anything from dropped database?

2007-02-15 Thread John D. Burger
I have a backup as of last night, but I'd like to recover something more recent if I can. If I'm stuck with the backup, I can just stop the postmaster, drop the whole PG directory into place from the backup, and restart, yes? I presume from the near-deafening silence there's nothing else I

Re: [GENERAL] Recover anything from dropped database?

2007-02-14 Thread John D. Burger
John D. Burger wrote: With a slip of the keyboard, I just dropped a database I'd like to have back. I don't have PITR or anything turned on - if nothing else has And no backups? been done to the cluster since then, is there any way to recover anything at all? I have a backup

[GENERAL] Recover anything from dropped database?

2007-02-14 Thread John D. Burger
With a slip of the keyboard, I just dropped a database I'd like to have back. I don't have PITR or anything turned on - if nothing else has been done to the cluster since then, is there any way to recover anything at all? Thanks. - John Burger MITRE ---(end of b

Re: [GENERAL] Production systems beware: U.S. Daylight Savings Time comes at a new time this year

2007-02-05 Thread John D. Burger
Sorry if I'm the only one to find this amusing, but I see that the original message was sent twenty minutes =after= I received it. :) - John D. Burger MITRE ---(end of broadcast)--- TIP 3: Have you checked our extensiv

Re: [GENERAL] How to allow users to log on only from my application

2007-02-02 Thread John D. Burger
s others have observed, a determined user can sniff the compound password out if they really wish. I suspect the only really secure approach is some sort of challenge-response algorithm, or a one-time pad in the application - in either case, whatever the black-hat user sniffs off the wire or

Fwd: [GENERAL] How to allow users to log on only from my application

2007-02-01 Thread John D. Burger
quite a lot about the secret. If this is an issue, there are more sophisticated combining schemes that give the user no advantage over someone who knows neither half of the secret. - John D. Burger MITRE ---(end of broadcast)--- TIP 6: e

Re: [GENERAL] Limit on number of users in postgresql?

2007-01-29 Thread John D. Burger
Tom Lane wrote: Since the tables you need to touch are all shared, it's conceivable that this could be hacked around, but it seems awfully messy. Another consideration is that this'd significantly increase the amount of work done before validating that the connection request is authorized,

Re: [GENERAL] counting query

2007-01-29 Thread John D. Burger
Joris Dobbelsteen wrote: Personally I've found nothing that will beat Excel for doing data analysis. Learn to use the pivot table and pivot charts. They are extremely powerful. Funny, there is an on-going discussion about this on one of our internal mailing lists. Excel is perhaps okay for

Re: [GENERAL] Limit on number of users in postgresql?

2007-01-29 Thread John D. Burger
I had some ideas about this slow flat file issue, but it's apparently not yet much of an issue, in fact ... Someone talked about the postmaster having to be "at arms' length" from the actual tables. But I was looking at the postmaster code, and it seems to fork a new backend as soon as sel

Re: [GENERAL] Limit on number of users in postgresql?

2007-01-29 Thread John D. Burger
ed would be to keep the out-of-memory copies of this kind of data in something faster than a flat file - say Berkeley DB. Do either of these things make sense? - John D. Burger MITRE ---(end of broadcast)--- TIP 3: Have you checked our exte

Re: [GENERAL] Example of RETURNING clause to get auto-generated keys

2007-01-24 Thread John D. Burger
Ken Johanson wrote: Just to be sure, will the RETURNING clause work with custom sequences (say, non numeric or increment by two) or other types of key generators?... And how will triggers interfere with it (if at all)? RETURNING has nothing to do with sequences per se - it's just a way

Re: [GENERAL] Finding bogus dates

2007-01-18 Thread John D. Burger
y more formats than I'd be likely to dream up on my own. - John D. Burger MITRE ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org/

Re: [GENERAL] Building web sites using a database

2007-01-17 Thread John D. Burger
Well, you could always start with something like Drupal: http://www.drupal.com I get access denied, seems to be here, rather: drupal.org - John Burger MITRE ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Question - Query based on WHERE OR

2007-01-11 Thread John D. Burger
Mike Poe wrote: SELECT foo, baz, bar FROM public.table WHERE lastname ~* '$lastname' OR ssn='$ssn'" I need to leave the last name a wildcard in case someone enters a partial name, lower case / upper case, etc. I want the SSN to match exactly if they search by that. The way it's written, if

Re: [GENERAL] MySQL drops support for most distributions

2006-12-13 Thread John D. Burger
Tom Lane wrote: The other point I'd make against John's argument is that there are a whole lot of Fortune 500 companies buying Red Hat support, and RH is effectively a third party for large chunks of Linux. (Of course, there are also large chunks for which Red Hat employees write as much code a

Re: [GENERAL] MySQL drops support for most distributions

2006-12-13 Thread John D. Burger
Joshua D. Drake wrote: Surely there are also third-party companies that provide "support" for MySqueal in some similar sense? Of course :) but... Fortune 2500+ for the most part will *not* use a third party for support for something like MySQL. Sure, but they won't use PG either, for essenti

Re: [GENERAL] MySQL drops support for most distributions

2006-12-13 Thread John D. Burger
The good thing is that there are several companies supporting Postgres, so whatever one of them does it does not affect the market as a whole. Surely there are also third-party companies that provide "support" for MySqueal in some similar sense? - John Burger MITRE

Re: [GENERAL] Male/female

2006-12-08 Thread John D. Burger
Steve Crawford wrote: Of course this breaks apart when dealing with that very rare syndrome (name escapes me) where the child appears female at birth but is actually a male whose male sex-organs descend and appear at puberty so I guess we need to add apparent_sex_at_birth. It turns out ther

Re: [GENERAL] Restore database from files (not dump files)?

2006-12-04 Thread John D. Burger
stallation - note that the above is only guaranteed to work if architecture/compiler/etc. are all the same. If the files were created by exactly the same PG instance, then you should be okay. - John D. Burger MITRE ---(end of broadcast)---

Re: [GENERAL] NULLs ;-)

2006-11-28 Thread John D. Burger
mething like: coalesce(a, 'SOME MAGIC VALUE') <> coalesce(b, 'SOME MAGIC VALUE') and wanted to make it work for any types. Sigh. - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] NULLs ;-)

2006-11-28 Thread John D. Burger
Scott Ribe wrote: where a <> b or (a is null and b is not null) or (a is not null and b is null) In the absence of IS DISTINCT FROM, I think this has the same semantics: where coalesce(a, b) <> coalesce(b, a) although it's not as concise as one might wish. - John

Re: [GENERAL] Buffer overflow in psql

2006-11-27 Thread John D. Burger
n the OP's code sample seems problematic in the other direction: sprintf(buf, "%u", (unsigned int)PQoidValue(results)); since unsigned int could be as small as 16 bits, thus truncating the OID value. Ok, I'll stop now, I promise. - John D. Burger MITRE

Re: [GENERAL] Buffer overflow in psql

2006-11-22 Thread John D. Burger
own problems. Sorry for the pedantry ... - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] advanced index (descending and table-presorted descending)

2006-11-22 Thread John D. Burger
suppose) and can take a while. Is there any way to convince the planner that the sorts are unnecessary, and it can just zip the two tables together as is? This is under PG 7.4, by the way. Any comments welcome. - John D. Burger MITRE ---(end of broadcast

Re: [GENERAL] CREATE TABLE initial value for PRIMARY KEY

2006-10-30 Thread John D. Burger
Maurice Yarrow wrote: So it turned out to be possible to do it like this: CREATE SEQUENCE id_seq; SELECT setval('id_seq',100111); FYI, you could have done this: CREATE SEQUENCE id_seq START 100111; - John D. Burger MITRE ---(end of

[GENERAL] SQL function inlining

2006-10-19 Thread John D. Burger
I'm having trouble figuring out when (if) the planner inlines sql functions (I'm running 7.4). I was assuming that pure sql functions are kind of like views with parameters, but I can't seem to see any cases where functions that select from a table get inlined. For instance: create func

Re: [GENERAL] timestamp as primary key?

2006-10-19 Thread John D. Burger
key a composite: PRIMARY KEY (user_id_from, user_id_to, message_time) This should cut way down on the possibility of key collision. - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] A query planner that learns

2006-10-16 Thread John D. Burger
Jochem van Dieten wrote: I think you might want to check US Patent 6,763,359 before you start writing any code. http://tinyurl.com/yzjdve - John D. Burger MITRE ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ

Re: [GENERAL] A query planner that learns

2006-10-13 Thread John D. Burger
to optionally use parametric modeling (this column is a Gaussian, let's estimate the mean and variance, this one is a Beta distribution ...). Then the smarter planner could spend some cycles applying more sophisticated statistical modeling to problematic tables/columns. - John D. B

Re: [GENERAL] Two efficiency questions - clustering and ints

2006-10-06 Thread John D. Burger
ownside= to doing it? Here's a simpler question - for static data, should I always cluster on the index I think will be used the most? Thanks. - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

[GENERAL] Two efficiency questions - clustering and ints

2006-10-05 Thread John D. Burger
es in [1, 10]. If I'm only comparing within such ratings, and possibly computing floating point averages, etc., what are the good and bad points of using, say, SMALLINT? What about NUMERIC(1) or (2)? Thanks in advance for the usual brilliant replies! - John D. Burg

Re: [GENERAL] Array assignment behavior (was Re: [ADMIN] Stored procedure array limits)

2006-09-29 Thread John D. Burger
here other languages where sequences behave similarly? > perl -e '@A = (1, 2, 3); print "@A\n"; $A[10] = 10; print "@A\n";' 1 2 3 1 2 310 - John D. Burger MITRE ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Expected accuracy of planner statistics

2006-09-29 Thread John D. Burger
have been surprised to find such a nice comment pointing me at the literature. - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Expected accuracy of planner statistics

2006-09-29 Thread John D. Burger
Tom Lane wrote: The information we've seen says that the only statistically reliable way to arrive at an accurate n_distinct estimate is to examine most of the table :-(. IIRC I picked an equation out of the literature partially on the basis of it being simple and fairly cheap to compute...

Re: [GENERAL] strange sum behaviour

2006-08-29 Thread John D. Burger
) This has nothing to do with SUM(): > select 4.88::float + 117.1::float + -121.98::float; ?column? -- -1.4210854715202e-14 (1 row) It's just the inherent inexactness of floating point, and probably not even particular to Postgres. - John D. Burger

Re: [GENERAL] Queries joining views

2006-08-21 Thread John D. Burger
g in the view definition as is. Presumably something minor (to me) but a show-stopper for the planner. Sorry for the distraction. :( - John D. Burger MITRE ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your

Re: [GENERAL] Queries joining views

2006-08-21 Thread John D. Burger
he view by hand. I was =very= surprised at this. - John D. Burger MITRE ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Error in PostgreSQL query with psycopg

2006-07-31 Thread John D. Burger
never, never, never try quoting on your own! You can only fail. The only choice is to fail now or later. Nonetheless, in case it's useful, here's a barebones wrapper I call on everything: def sqlValue (value): if value is None: return "NULL" elif type(value) == types.StringType:

Re: [GENERAL] How to insert .xls files into database

2006-07-07 Thread John D. Burger
One option is to write a Python translator to create CSV files, or even an uploader to go directly from the Excel files to the database. There is at least one module to read Excel files, in all their complexity: http://cheeseshop.python.org/pypi/xlrd/0.5.2 and a number of Postgres modules:

  1   2   >