[SQL] Quickest way to insert unique records?

2002-06-26 Thread Ian Cass
Hi, I've got a number of files containing generic log data & some of the lines may or may not be duplicated across files that I'm feeding into a database using Perl DBI. I'm just ignoring any duplicate record errors. This is fine for day to day running when the data feeds in at a sensible rate, h

[SQL] 2 Selects 1 is faster, why?

2002-06-26 Thread Eric
If I perform the following 2 selects, the first one is EXTREMELY slow where the 2nd one is very fast. (1) Slow select o.orderid, ol.itemcode, ol.itemname from orders o, orlines ol where o.orderid = '1234' and ol.orderid = o.orderid; (2) VERY FAST select o.orderid, ol.itemco

[SQL] Performance Ideas

2002-06-26 Thread Eric
I have a SQL which uses a function for one of the returned rows. This stored function does calculations that are expensive & slow. I am looking for ways to speed up this query but having no luck. Any SQL geniuses out there help me with this? select o.orderid, ol.itemcode, ol.itemname, ol.

Re: [SQL] Limiting database size

2002-06-26 Thread Eric
I like the idea of putting it on a hard disk or partition of fixed size and waiting for the DB to simply crash. hahaha "Josh Berkus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Mauricio, > > > Hi, is there any way to limit the database size?? > > First, this is a question fo

Re: [SQL] what is the difference between default 0 vs default '0'

2002-06-26 Thread Lee Harr
In article <000c01c21cab$c2f35ef0$6901a8c0@bethvizx>, "Beth Gatewood" wrote: > all- > Could somebody tell me why I would use default 0 vs default '0' in the > following > CREATE TABLE foo (col1 INTEGER default 0) <-- or default '0' > 0 is an integer '0' is a string default '0' might work (t

[SQL] sequence chages after firing update

2002-06-26 Thread Subhashini Karthikeyan
hi all In postgresql 7.1.3 i am updateing a row. it is a 4th record. after updation if i am firing a select query it is coming as a last record ..what shall i do to avoid that.. any help appriciated thankz in advance regards subha __ Do You Ya

Re: [SQL] Performance Ideas

2002-06-26 Thread Tom Lane
"Eric" <[EMAIL PROTECTED]> writes: > select > o.orderid, > ol.itemcode, > ol.itemname, > ol.uom, > qty_available( ol.itemcode, ol.uom ) as "Qty On Hand" > from > orders o, > orderlines ol, > where > o.status = 'OPEN' and > ol.orderid = o.orderid and > qty_onhand( ol.itemcode, ol.uo

Re: [SQL] sequence chages after firing update

2002-06-26 Thread Stephan Szabo
On Wed, 26 Jun 2002, Subhashini Karthikeyan wrote: > In postgresql 7.1.3 > > i am updateing a row. it is a 4th record. > after updation if i am firing a select query it is > coming as a last record ..what shall i do to avoid > that.. > any help appriciated If I understand the complaint, use an

Re: [SQL] sequence chages after firing update

2002-06-26 Thread Rajesh Kumar Mallah.
dear subha, Use explicit ORDER BY if u want to order the records by some column. otherwise the order of output from a select stmt is undefined. bu generally it is found the the last updated record comes last. On Wednesday 26 June 2002 17:17, Subhashini Karthikeyan wrote: > hi all > > > In post

[SQL] Efficient Query For Mapping IP Addresses To Country Code.

2002-06-26 Thread Rajesh Kumar Mallah.
Hi folks, the problem is to update one table by querying another. i have a table where i store apache access logs where one of the fields is the host ip address. i need to find corresponding country for all the ip addrresses. for this i have another table that contains apnic,arin and ripe data

Re: [SQL] 2 Selects 1 is faster, why?

2002-06-26 Thread Alvar Freude
Hi, -- Eric <[EMAIL PROTECTED]> wrote: > If I perform the following 2 selects, the first one is EXTREMELY slow > where the 2nd one is very fast. [...] > Why would 2 be so much faster? I have ran the EXPLAIN on this and index > scans are being used. I guess, the first query has to search for

[SQL] Possibility of Index-Only access in PostgreSQL?

2002-06-26 Thread Gunther Schadow
Hello, we have a simple query here that uses a table such as Foo(id*, bar, baz) were id is a primary key and then we have an additional index on Foo(bar, baz). Now, we have a simple query such as this: SELECT bar, baz FROM Foo WHERE bar='HIT'; The Foo table has about 25 million rows and the abo

Re: [SQL] Limiting database size

2002-06-26 Thread Josh Berkus
Eric, > I like the idea of putting it on a hard disk or partition of fixed size and > waiting for the DB to simply crash. > hahaha Yeah. It's what MS SQL Server does, though. As I said, I think the whole concept of limiting database size in MB is fundamentally flawed. I mean, what's th

Re: [SQL] Limiting database size

2002-06-26 Thread terry
>> Yeah. It's what MS SQL Server does, though. As I >> said, I think the whole concept of limiting database size in >> MB is fundamentally flawed. I mean, what's the database >> supposed to do when it runs out of space? Display a window that says: "Management has determined that this d

Re: [SQL] Possibility of Index-Only access in PostgreSQL?

2002-06-26 Thread Tom Lane
Gunther Schadow <[EMAIL PROTECTED]> writes: > I would be very eager to have > index-only reads in PostgreSQL. It won't happen. See the many, many prior discussions of this point in the archives. Something we perhaps *could* do is to "batch" index reads: pull a bunch of TIDs from the index, sort

Re: [SQL] Limiting database size

2002-06-26 Thread Thomas Swan
Josh Berkus wrote: Eric, I like the idea of putting it on a hard disk or partition of fixed size and waiting for the DB to simply crash. hahaha Yeah. It's what MS SQL Server does, though. As I said, I think the whole concept of limiting database size in MB is fundamen

[SQL] pg_restore cannot restore function

2002-06-26 Thread Jie Liang
I use pg_dump -Fc mydb > dbf then I create anpther db by: createdb mydb2 I use pg_restore -P myfunction -d mydb2 dbf cannot restore myfunction into mydb2 why?? Jie Liang ---(end of broadcast)--- TIP 3: if posting/reading through Usenet,

Re: [SQL] Possibility of Index-Only access in PostgreSQL?

2002-06-26 Thread Christopher Kings-Lynne
> - Oracle is content with data read from an index if that is all that's >needed. Indeed, I only need bar and baz and those are in the index. >The benefits of not having to seek the scattered rows from the data >table saves 35000 back and forth head movements / seeks. Postgres can't u