[Python] Applicazione WEB con Python e Postgresql

Marco Fochesato marcofoc a gmail.com
Mar 23 Set 2014 22:01:26 CEST


2014-09-23 19:19 GMT+02:00 Carlos Catucci <carlos.catucci a gmail.com>:

>
> 2014-09-23 17:32 GMT+02:00 Marco Fochesato <marcofoc a gmail.com>:
> >
> > Va bene!
> > Si infatti, per "sentirmi stretto", parlavo di quello: perchè deve
> esserci per forza na colonna id??
>
> 1 - It's faster. A JOIN on an integer is much quicker than a JOIN on a
> string field or combination of fields. It's more efficient to compare
> integers than strings.
>
> 2 - It's simpler. It's much easier to map relations based on a single
> numeric field than on a combination of other fields of varying data types.
>
> 3 - It's data-independent. If you match on the ID you don't need to worry
> about the relation changing. If you match on a name, what do you do if
> their name changes (i.e. marriage)? If you match on an address, what if
> someone moves?
>
> 4 - It's more efficient If you cluster on an (auto incrementing) int
> field, you reduce fragmentation and reduce overall size of the data set.
> This also simplifies indexes needed to cover your relations.
>

Certo certo certo! Non discuto il fatto che un integer stia bene come id.
Mi lamentavo solo del NOMEella colonna: perchè si deve per forza chiamare
ID, con Django?
Al problema mi ha già risolto Daniele.

>
>
> Fai pure
>
>
> Grazie!

-- 
Marco Fochesato
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20140923/105d1710/attachment.html>


Maggiori informazioni sulla lista Python