pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SELECT TOP _x_ ??
5+ messages / 3 participants
[nested] [flat]

* SELECT TOP _x_ ??
@ 1999-04-22 14:33 Justin Long <justinlong@strategicnetwork.org>
  1999-04-22 14:42 ` Re: [SQL] SELECT TOP _x_ ?? Chris Bitmead <chris.bitmead@bigfoot.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Justin Long @ 1999-04-22 14:33 UTC (permalink / raw)
  To: pgsql-sql@hub.org

In Microsoft SQL Server you could issue a command

	SELECT TOP 5 * FROM database...


The top 5 indicator would mean to take the top 5 records that matched the
criteria. I can't seem to find any way to do this in PostgreSQL. I have a
database of 385 records (which will grow rapidly over the next few months)
and it takes better than 5 seconds to SELECT from the 385 and then use a
while loop to display the top 4. I can't imagine what it will be like when
we reach, say, 10,000 records! So any suggestions for selecting just the top
5 and speeding the process up a bit?

Any responses will be greatly appreciated. Respond here or to
JustinLong@strategicnetwork.org ...


Never retreat. Never surrender. Never cut a deal with a dragon.
_______________________________________________________________
Justin Long                   CIO / Site Editor
616 Station Square Ct         Network for Strategic Missions
Chesapeake, VA 23320          977 Centerville Trnpk CSB 317
JustinLong@xc.org             Va Beach, VA 23463
Check out our site at:        http://www.strategicnetwork.org




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] SELECT TOP _x_ ??
  1999-04-22 14:33 SELECT TOP _x_ ?? Justin Long <justinlong@strategicnetwork.org>
@ 1999-04-22 14:42 ` Chris Bitmead <chris.bitmead@bigfoot.com>
  1999-04-23 08:36   ` Re: [SQL] SELECT TOP _x_ ?? Chairudin Sentosa <chairudin@prima.net.id>
  0 siblings, 1 reply; 5+ messages in thread

From: Chris Bitmead @ 1999-04-22 14:42 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Justin Long wrote:
> 
> In Microsoft SQL Server you could issue a command
> 
>         SELECT TOP 5 * FROM database...

SELECT * FROM TABLE LIMIT 5;

You may have to be running 6.5, not sure.

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] SELECT TOP _x_ ??
  1999-04-22 14:33 SELECT TOP _x_ ?? Justin Long <justinlong@strategicnetwork.org>
  1999-04-22 14:42 ` Re: [SQL] SELECT TOP _x_ ?? Chris Bitmead <chris.bitmead@bigfoot.com>
@ 1999-04-23 08:36   ` Chairudin Sentosa <chairudin@prima.net.id>
  1999-04-23 02:34     ` Re: [SQL] SELECT TOP _x_ ?? Chris Bitmead <chris.bitmead@bigfoot.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Chairudin Sentosa @ 1999-04-23 08:36 UTC (permalink / raw)
  To: Chris Bitmead <chris.bitmead@bigfoot.com>; +Cc: pgsql-sql@hub.org

I tried this, did not work.

ibs=> select * from ibs_subscriber limit 5;
ERROR:  parser: syntax error at or near "5"

Regards,
Chai

PS: PostgreSQL 6.5 snapshot.

Chris Bitmead wrote:

> Justin Long wrote:
> >
> > In Microsoft SQL Server you could issue a command
> >
> >         SELECT TOP 5 * FROM database...
>
> SELECT * FROM TABLE LIMIT 5;
>
> You may have to be running 6.5, not sure.
>
> --
> Chris Bitmead
> http://www.bigfoot.com/~chris.bitmead
> mailto:chris.bitmead@bigfoot.com




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] SELECT TOP _x_ ??
  1999-04-22 14:33 SELECT TOP _x_ ?? Justin Long <justinlong@strategicnetwork.org>
  1999-04-22 14:42 ` Re: [SQL] SELECT TOP _x_ ?? Chris Bitmead <chris.bitmead@bigfoot.com>
  1999-04-23 08:36   ` Re: [SQL] SELECT TOP _x_ ?? Chairudin Sentosa <chairudin@prima.net.id>
@ 1999-04-23 02:34     ` Chris Bitmead <chris.bitmead@bigfoot.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Chris Bitmead @ 1999-04-23 02:34 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Chairudin Sentosa wrote:
> 
> I tried this, did not work.
> 
> ibs=> select * from ibs_subscriber limit 5;
> ERROR:  parser: syntax error at or near "5"
> 
> Regards,
> Chai
> 
> PS: PostgreSQL 6.5 

Which snapshot?

> 
> Chris Bitmead wrote:
> 
> > Justin Long wrote:
> > >
> > > In Microsoft SQL Server you could issue a command
> > >
> > >         SELECT TOP 5 * FROM database...
> >
> > SELECT * FROM TABLE LIMIT 5;
> >
> > You may have to be running 6.5, not sure.
> >
> > --
> > Chris Bitmead
> > http://www.bigfoot.com/~chris.bitmead
> > mailto:chris.bitmead@bigfoot.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* FW: [SQL] SELECT TOP _x_ ??
@ 1999-04-23 14:33 Justin Long <justinlong@strategicnetwork.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Justin Long @ 1999-04-23 14:33 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Thanks for the help - it turned out that 6.5 hadn't copied its binaries into
the /usr/bin directory, and the binaries there were still 6.4.2. Resolving
that solved everything.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~1999-04-23 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-22 14:33 SELECT TOP _x_ ?? Justin Long <justinlong@strategicnetwork.org>
1999-04-22 14:42 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-04-23 08:36   ` Chairudin Sentosa <chairudin@prima.net.id>
1999-04-23 02:34     ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-04-23 14:33 FW: [SQL] SELECT TOP _x_ ?? Justin Long <justinlong@strategicnetwork.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox