pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedselect slow?
6+ messages / 4 participants
[nested] [flat]
* select slow?
@ 2004-03-30 19:25 Jaime Casanova <el_vigia_ec@hotmail.com>
2004-03-30 19:39 ` Re: select slow? Paul Thomas <paul@tmsl.demon.co.uk>
2004-03-31 08:33 ` Re: select slow? Richard Huxton <dev@archonet.com>
0 siblings, 2 replies; 6+ messages in thread
From: Jaime Casanova @ 2004-03-30 19:25 UTC (permalink / raw)
To: pgsql-performance
hi all,
i have an amd athlon with 256 ram (i know, this is not a *real* server but
my tables are small)
i'm using vb6 (win98) with pgsql-7.3.4 (rh8) trough the psqlodbc.
when i do a select in took long to execute, here is an example
table icc_m_banco
CREATE TABLE ICC_M_BANCO (
CodBanco SMALLINT NOT NULL,
Descripcion CHARACTER VARYING(60) NOT NULL,
RefContable NUMERIC,
Estado CHAR(1) NOT NULL,
FecRegistro DATE NOT NULL,
CONSTRAINT EstadoBanco CHECK ((Estado = 'A') or (Estado = 'I')),
PRIMARY KEY(CodBanco)
);
select * from icc_m_banco where codbanco = 1;
it tooks 13s from it's send until it's executed.
explain analyze give me this result:
explain analyze
select * from icc_m_banco where codbanco = 1;
Seq Scan on icc_m_banco (cost=0.00..1.06 rows=6 width=41) (actual
time=7.94..7.96 rows=4 loops=1)
Total runtime: 63.37 msec
(2 rows)
so i think its not a database problem (at least it's not all the problem),
though it seems to me it is taking a lot of time executing this.
am i right? any suggestions?
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: select slow?
2004-03-30 19:25 select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
@ 2004-03-30 19:39 ` Paul Thomas <paul@tmsl.demon.co.uk>
1 sibling, 0 replies; 6+ messages in thread
From: Paul Thomas @ 2004-03-30 19:39 UTC (permalink / raw)
To: Jaime Casanova <el_vigia_ec@hotmail.com>; +Cc: pgsql-performance
On 30/03/2004 20:25 Jaime Casanova wrote:
> hi all,
>
>
> i have an amd athlon with 256 ram (i know, this is not a *real* server
> but my tables are small)
>
> i'm using vb6 (win98) with pgsql-7.3.4 (rh8) trough the psqlodbc.
>
> when i do a select in took long to execute, here is an example
>
>
> table icc_m_banco
>
> CREATE TABLE ICC_M_BANCO (
> CodBanco SMALLINT NOT NULL,
> Descripcion CHARACTER VARYING(60) NOT NULL,
> RefContable NUMERIC,
> Estado CHAR(1) NOT NULL,
> FecRegistro DATE NOT NULL,
> CONSTRAINT EstadoBanco CHECK ((Estado = 'A') or (Estado = 'I')),
> PRIMARY KEY(CodBanco)
> );
>
>
> select * from icc_m_banco where codbanco = 1;
select * from icc_m_banco where codbanco = 1::int2;
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: select slow?
2004-03-30 19:25 select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
@ 2004-03-31 08:33 ` Richard Huxton <dev@archonet.com>
1 sibling, 0 replies; 6+ messages in thread
From: Richard Huxton @ 2004-03-31 08:33 UTC (permalink / raw)
To: Jaime Casanova <el_vigia_ec@hotmail.com>; pgsql-performance
On Tuesday 30 March 2004 20:25, Jaime Casanova wrote:
> hi all,
>
>
> i have an amd athlon with 256 ram (i know, this is not a *real* server but
> my tables are small)
Nothing wrong with it - it's what I still use as my development server.
> i'm using vb6 (win98) with pgsql-7.3.4 (rh8) trough the psqlodbc.
>
> when i do a select in took long to execute, here is an example
> CREATE TABLE ICC_M_BANCO (
> CodBanco SMALLINT NOT NULL,
> select * from icc_m_banco where codbanco = 1;
>
> it tooks 13s from it's send until it's executed.
Try:
SELECT * FROM icc_m_banco WHERE codbanco = 1::smallint;
By default, PG will treat a numeric constant as integer not smallint, so when
it looks for an index it can't find one for integer, so scans instead.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: select slow?
@ 2004-03-31 14:27 Jaime Casanova <el_vigia_ec@hotmail.com>
2004-03-31 15:40 ` Re: select slow? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Jaime Casanova @ 2004-03-31 14:27 UTC (permalink / raw)
To: pgsql-performance
>
>On Tuesday 30 March 2004 20:25, Jaime Casanova wrote:
>>hi all,
> >
> >
> > i have an amd athlon with 256 ram (i know, this is not a *real* server
>but
> > my tables are small)
>Nothing wrong with it - it's what I still use as my development server.
>
> > i'm using vb6 (win98) with pgsql-7.3.4 (rh8) trough the psqlodbc.
> >
> > when i do a select in took long to execute, here is an example
>
> > CREATE TABLE ICC_M_BANCO (
> > CodBanco SMALLINT NOT NULL,
> > select * from icc_m_banco where codbanco = 1;
> >
> > it tooks 13s from it's send until it's executed.
>
>Try:
> SELECT * FROM icc_m_banco WHERE codbanco = 1::smallint;
>
>By default, PG will treat a numeric constant as integer not smallint, so
>when
>it looks for an index it can't find one for integer, so scans instead.
>
>--
> Richard Huxton
> Archonet Ltd
There are no indexes yet, and the table is just 6 rows long so even if
indexes exists the planner will do a seq scan. that's my whole point 63m for
seq scan in 6 rows table is too much.
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: select slow?
2004-03-31 14:27 Re: select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
@ 2004-03-31 15:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-03-31 17:27 ` Re: select slow? Paul Thomas <paul@tmsl.demon.co.uk>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2004-03-31 15:40 UTC (permalink / raw)
To: Jaime Casanova <el_vigia_ec@hotmail.com>; +Cc: pgsql-performance
"Jaime Casanova" <el_vigia_ec@hotmail.com> writes:
> There are no indexes yet, and the table is just 6 rows long so even if
> indexes exists the planner will do a seq scan. that's my whole point 63m for
> seq scan in 6 rows table is too much.
That was 63 milliseconds, according to your original post, which seems
perfectly reasonable to me seeing that it's not a super-duper server.
The problem sounds to be either on the client side or somewhere in your
network. I don't know anything about VB, but you might want to look
through the client-side operations to see what could be eating up the 13
seconds.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: select slow?
2004-03-31 14:27 Re: select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
2004-03-31 15:40 ` Re: select slow? Tom Lane <tgl@sss.pgh.pa.us>
@ 2004-03-31 17:27 ` Paul Thomas <paul@tmsl.demon.co.uk>
0 siblings, 0 replies; 6+ messages in thread
From: Paul Thomas @ 2004-03-31 17:27 UTC (permalink / raw)
To: pgsql-performance
On 31/03/2004 16:40 Tom Lane wrote:
> "Jaime Casanova" <el_vigia_ec@hotmail.com> writes:
> > There are no indexes yet, and the table is just 6 rows long so even if
> > indexes exists the planner will do a seq scan. that's my whole point
> 63m for
> > seq scan in 6 rows table is too much.
>
> That was 63 milliseconds, according to your original post, which seems
> perfectly reasonable to me seeing that it's not a super-duper server.
>
> The problem sounds to be either on the client side or somewhere in your
> network. I don't know anything about VB, but you might want to look
> through the client-side operations to see what could be eating up the 13
> seconds.
Given that the client and server are on different machines, I'm wondering
the bulk of the 13 seconds is due a network mis-configuration or a very
slow DNS server...
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2004-03-31 17:27 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-30 19:25 select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
2004-03-30 19:39 ` Paul Thomas <paul@tmsl.demon.co.uk>
2004-03-31 08:33 ` Richard Huxton <dev@archonet.com>
2004-03-31 14:27 Re: select slow? Jaime Casanova <el_vigia_ec@hotmail.com>
2004-03-31 15:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-03-31 17:27 ` Paul Thomas <paul@tmsl.demon.co.uk>
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