Re: result set offset -limit que con una query no se encuentra

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: Lista Postgres <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: result set offset -limit que con una query no se encuentra
Date: 2009-05-08 16:26:24
Message-ID: f205bb120905080926y24e8d81cj37ba4f9b73d793ac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2009/5/8 Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>:
> Gente, estoy con pgsql8.4 beta1 y me pasa lo siguiente:
>
> select * from datos limit 1 offset 167914;
>
>              texto               | entero2 |  entero4  |
> entero8       |      float       |
>  fecha    |           tiempo           |            ztiempo
> |       ip
> ----------------------------------+---------+-----------+---------------------+------------------+--
> ----------+----------------------------+-------------------------------+-----------------
>  18e4745193af9e699014edf21bb86e85 |    1103 | -24471577 |
> 2064845141951966355 | 305.908181944396 | 2
> 009-05-08 | 2009-05-08 12:02:28.195846 | 2009-05-08 12:02:28.195846-03
> | 34.132.9.141/32
> (1 row)
>
> parapruebas=# select * from datos limit 1 offset 167914;
> parapruebas=# select entero8, float from datos limit 1 offset 167914;
>       entero8       |      float
> ---------------------+------------------
>  4201021101379964833 | 529.568756118882
> (1 row)
>
> parapruebas=# select entero4, entero8, float from datos limit 1 offset 167914;
>  entero4  |       entero8       |      float
> -----------+---------------------+------------------
>  153051873 | -156940279311698037 | 536.905172820669
> (1 row)
>
>
> No hay campos con valores nulos.
>
> Si miran bien los valores son distintos... :O
>
>
> Lo único que cree fue una tabla heredada en memoria...
> CREATE TABLE datos_ram() INHERITS (datos) TABLESPACE ramy;
>
>                                                           QUERY PLAN
>
> ----------------------------------------------------------------------------------------------------
> -----------------------------
>  Limit  (cost=4013.49..4013.52 rows=1 width=20) (actual
> time=2969.851..2969.853 rows=1 loops=1)
>   ->  Result  (cost=0.00..4028.36 rows=168536 width=20) (actual
> time=0.022..2492.754 rows=167915 lo
> ops=1)
>         ->  Append  (cost=0.00..4028.36 rows=168536 width=20) (actual
> time=0.017..1515.252 rows=167
> 915 loops=1)
>               ->  Seq Scan on datos  (cost=0.00..4012.36 rows=167936
> width=20) (actual time=0.011..
> 551.485 rows=167915 loops=1)
>               ->  Seq Scan on datos_ram datos  (cost=0.00..16.00
> rows=600 width=20) (never executed
> )
>  Total runtime: 2969.936 ms
> (6 rows)
>
>
> Borré la tabla heredada y los resultados son estos:
>
> parapruebas=# select entero4, entero8, float from datos limit 1 offset 167914;
>  entero4  |      entero8       |      float
> -----------+--------------------+------------------o8, float from
> datos limit 1 o
>  -17054690 | 174907075697610278 | 245.718919624574
> (1 row)
>
> parapruebas=# select entero8, float from datos limit 1 offset 167914;
>       entero8       |      float
> ---------------------+------------------
>  1939054161121250427 | 403.497909076978
> (1 row)
>
>
>
> No hay indices de ningun tipo.
>

Agrego:

Column | Type | Modifiers
---------+-----------------------------+------------------------------------------------------------
texto | text | default md5((random())::text)
entero2 | smallint | default
(rpad((hashtext((random())::text))::text, 4))::smallint
entero4 | integer | default
(lpad(((hashtext((random())::text))::text ||
replace((hashtext((random())::text))::text, '-'::text, ''::text)),
9))::integer
entero8 | bigint | default
(rpad(((hashtext((random())::text))::text ||
replace((hashtext((random())::text))::text, '-'::text, ''::text)),
19))::bigint
float | double precision | default ((random() *
(1000)::double precision) + random())
fecha | date | default (now())::date
tiempo | timestamp without time zone | default now()
ztiempo | timestamp with time zone | default now()
ip | cidr | default
((((((((pg_round_random_range(0, 255))::text || '.'::text) ||
(pg_round_random_range(0, 255))::text) || '.'::text) || (pg_round_

Estos son los datos de la tabla 'datos'.

La info se inserta con 'insert into datos default values'.

--
Emanuel Calvo Franco
Sumate al ARPUG !
( www.arpug.com.ar)
ArPUG / AOSUG Member

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2009-05-08 16:27:58 Re: result set offset -limit que con una query no se encuentra
Previous Message Jorge Medina 2009-05-08 16:23:25 Re: use_connection_pooling