Em 13 de junho de 2011 09:29, Tiago Adami <adam...@gmail.com> escreveu:

>
> <corte>
>
> Considerando:
> cnpj VARCHAR(20) = 20 +1 Bytes
> razao_social VARCHAR(100) = 100 +1 Bytes
> nome_fantasia VARCHAR(100) = 100 +1 Bytes
> data_cadastro DATE = 4 Bytes
> datahora_alteracao TIMESTAMP = 8 Bytes
> valor_faturamento NUMERIC (18, 2 ) = 9 + 5~8 Bytes
> num_funcionarios INTEGER = 4 Bytes
>
> Neste caso, cada linha ocuparia no máximo 256 Bytes, estou correto?
>
>
Lembre-se de considerar os tamanhos das colunas:

oid = 4 bytes (caso sua tabela tenha sido criada com WITH OIDs)
tableoid = 4 bytes
cmax = 4 bytes
xmax = 4 bytes
cmin = 4 bytes
xmin = 4 bytes
ctid = 6 bytes

(nao lembro se tem mais alguma coluna *escondida*, alguem ajuda?)

Abaixo uma pequena query no catálogo para ajudar na sua "empreitada"
(lembrando que ela não está bem completa);

bdteste=# create table foo(codigo serial, nome varchar(100), data date, qtd
integer);
NOTICE:  CREATE TABLE will create implicit sequence "foo_codigo_seq" for
serial column "foo.codigo"
CREATE TABLE

bdteste=# select attname, attlen, typname, typlen, attndims from
pg_attribute a join pg_class c on a.attrelid = c.oid join pg_type t on
a.atttypid = t.oid where c.relname = 'foo';
 attname  | attlen | typname | typlen | attndims
----------+--------+---------+--------+----------
 tableoid |      4 | oid     |      4 |        0
 cmax     |      4 | cid     |      4 |        0
 xmax     |      4 | xid     |      4 |        0
 cmin     |      4 | cid     |      4 |        0
 xmin     |      4 | xid     |      4 |        0
 ctid     |      6 | tid     |      6 |        0
 codigo   |      4 | int4    |      4 |        0
 nome     |     -1 | varchar |     -1 |        0
 data     |      4 | date    |      4 |        0
 qtd      |      4 | int4    |      4 |        0
(10 rows)


-- 
Fabrízio de Royes Mello
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a