Re: [SQL] [HACKERS] why is postgres estimating so badly?

2002-07-18 Thread Luis Alberto Amigo Navarro
> > AND part.name LIKE '%green%' > > It's difficult for the planner to produce a decent estimate for the > selectivity of an unanchored LIKE clause, since there are no statistics > it can use for the purpose. We recently changed FIXED_CHAR_SEL in > src/backend/utils/adt/selfuncs.c from 0.04 to

[SQL] how do i import my sql query result to a file

2002-07-18 Thread Joseph Syjuco
how do i import results of my select query to a file thanks ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] how do i import my sql query result to a file

2002-07-18 Thread Steve Brett
\? will get you a list of the commands in psql. Steve > -Original Message- > From: Joseph Syjuco [mailto:[EMAIL PROTECTED]] > Sent: 18 July 2002 22:47 > To: [EMAIL PROTECTED] > Subject: [SQL] how do i import my sql query result to a file > > > how do i import results of my select query

Re: [SQL] Newbie: Creative use of LIMIT??

2002-07-18 Thread Richard Huxton
On Wednesday 17 Jul 2002 3:20 am, Shmuel A. Kahn wrote: > Assuming I have the following two tables of people and their nicknames, > and that I want to create a list containing UPTO 2 (or any value > greater than 1) nicknames for EACH member of a specific family (Fam > column), how would I do this?

[SQL] about Inheritance...

2002-07-18 Thread frederik nietzsche
Hi all, I'm still in trouble with inheritance. Now I've created some triggers and rules for realize something similiar to an inheritance... I MUST do myself all the check for integrity, it seems the only way. But because psql executes a function in a transaction it was not so bad... In practice, i

[SQL] hints or suggestion for optimizer

2002-07-18 Thread adrian
How can I optimize Postrges SQL when I would like have ordering kolumns without clause ORDER BY - in Oracle you can use hints to suggestion optimizer. for example. SELECT /*+ INDEX_ASC TAB(TAB_PK) +/ * FROM TAB - most efficent SELECT * FROM TAB ORDER BY TAB_PK where TAB_PK - is unique

Re: [SQL] How to find out if an index is unique?

2002-07-18 Thread Ligia Pimentel
You could also use describe (in psql environment ) psql mydatabase mydatabase=# \d indexname Index "indexname" Attribute | Type +--- fieldname| datatype unique btree The word "unique" will show up only if the index has the unique qualification, otherwise it wi

Re: [SQL] [HACKERS] why is postgres estimating so badly?

2002-07-18 Thread Nathan C. Burnett
The first thing to point out is that the estimated cost is measured in terms of page reads while the actual time is measured in milliseconds. So even if the cost estimate is accurate it is unlikely that those numbers will be the same. -N -- Nathan C. Burnett Research Assistant, Wisconsin Networ

Re: [SQL] How to find out if an index is unique?

2002-07-18 Thread Christoph Haller
Dirk, May be you can use this create view sesql_userindexes as SELECT upper(c.relname) AS TBL_NAME, upper(i.relname) AS IDX_NAME, CASE WHEN x.indisunique=false THEN 0 ELSE 1 END AS UNIQUE_FLAG, 1+ (CASE WHEN x.indkey[1]=0 THEN 0 ELSE 1 END)+(CASE WHEN x.indkey[2]=0 THEN 0 ELSE 1 END)+ (CASE W

Re: [SQL] how do i import my sql query result to a file

2002-07-18 Thread Robert Treat
not sure I understand the question, but from inside psql you can do: \o FILENAMEsend all query results to file or |pipe Robert Treat On Thu, 2002-07-18 at 17:47, Joseph Syjuco wrote: > how do i import results of my select query to a file > thanks > > > > > ---(end

Re: [SQL] Indexing UNIONs

2002-07-18 Thread Josh Berkus
Bruno, > My suggestion: > SELECT t3.id, coalesce(t1.name, t2.name), t1.abbreviation, > coalesce(t1.juris_id, t2.juris_id) from > (t3 left join t1 using (id)) left join t2 using (id); Cool! I didn't think of that. I'll give it a try. -Josh ---(end of broadcast)

Re: [SQL] how do i import my sql query result to a file

2002-07-18 Thread Ludwig Lim
--- Joseph Syjuco <[EMAIL PROTECTED]> wrote: > how do i import results of my select query to a file > thanks > in the psql command prompt type \o and then type your select query. The result will be dumped into ludwig. __ Do You Yahoo!? Yahoo!

Re: [SQL] how do i import my sql query result to a file

2002-07-18 Thread Joseph Syjuco
thanks for the tips !!! actually i used \g . Again thanks On Thu, 2002-07-18 at 20:34, Ludwig Lim wrote: > > --- Joseph Syjuco <[EMAIL PROTECTED]> wrote: > > how do i import results of my select query to a file > > thanks > > > > in the psql command prompt type > \o > > and then type your s

[SQL] id and ID in CREATE TABLE

2002-07-18 Thread stefan
Hello all, It might be not a correct place to post this. I am creating a table from psql. Everything is fine except I got some troubles when trying to create the same table but in a different way and with pgaccess. If I have this sql: CREATE TABLE ttt ( ID int2, name text

Re: [SQL] id and ID in CREATE TABLE

2002-07-18 Thread Christopher Kings-Lynne
> Can somebody explain me a bit about: > > 1. As far as I know column names in Tables are not case > sensitive. Correct ? > So I know if I pickup ID is not a clever idea but for this > example it is ok. I think your examples have proved that column names are in fact very much case sensitive. How

Re: [SQL] id and ID in CREATE TABLE

2002-07-18 Thread stefan
I forgot about "" Sorry. So if I would use names quoted then my questions are obsolete. Except one: So actually the only strange part would be PostgreSQL is folding to lower cases a column name ... >From docs: The folding of unquoted names to lower case in PostgreSQL is incompatible with