Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-09-12 Thread Jim Nasby
On 8/31/13 8:35 AM, Łukasz Walkowski wrote: 3. And this part is most interesting for me. Columns browser, eventsource, eventtype, devicetype, operatingsystem contain a small pool of strings - for example for devicetype this is set to Computer, Mobile, Tablet or Unknown. Browser is set to

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-09-03 Thread Vitalii Tymchyshyn
Well, in older version of Hibernate it was a little tricky to handle Postgresql Enums. Dunno if it's out of the box now. Also adding new value is an explicit operation (much like with lookup table). I've had quite a complex code with second connection opening to support lookup table filling

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-09-02 Thread Łukasz Walkowski
On 1 wrz 2013, at 03:31, Craig James cja...@emolecules.com wrote: If your applications are read-heavy and only have a small-ish amount of code that inserts/updates the table, it may not be that much of a rewrite. You can create a integer/varchar table of key/values, use its key to replace

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-09-02 Thread Łukasz Walkowski
On 1 wrz 2013, at 05:10, Vitalii Tymchyshyn tiv...@gmail.com wrote: Well, there are some more options: a) Store int keys and do mapping in the application (e.g. with java enums). This can save you a join, that is especially useful if you are going to do paged output with limit/offset

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-09-02 Thread Andrew Dunstan
On 09/02/2013 05:53 AM, Łukasz Walkowski wrote: On 1 wrz 2013, at 05:10, Vitalii Tymchyshyn tiv...@gmail.com wrote: Well, there are some more options: a) Store int keys and do mapping in the application (e.g. with java enums). This can save you a join, that is especially useful if you are

[PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-08-31 Thread Łukasz Walkowski
Hi, This is my first post on this group so welcome everyone! Currently I'm working on optimizing a quite simple database used to store events from one website. Every event is a set of data describing user behaviour. The main table that stores all events is built using schema: Column

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-08-31 Thread Tom Lane
=?utf-8?Q?=C5=81ukasz_Walkowski?= lukasz.walkow...@homplex.pl writes: 3. And this part is most interesting for me. Columns browser, eventsource, eventtype, devicetype, operatingsystem contain a small pool of strings - for example for devicetype this is set to Computer, Mobile, Tablet or

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-08-31 Thread Łukasz Walkowski
Tom, If you're starting to be concerned about space, it's definitely time to get away from this choice. Depending on what locale you're using, comparing varchar values can be quite an expensive operation, too. I don't like wasting space and processing power even if more work is required to

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-08-31 Thread Craig James
On Sat, Aug 31, 2013 at 10:06 AM, Łukasz Walkowski lukasz.walkow...@homplex.pl wrote: I think the main pro of this approach is that it doesn't use any nonstandard SQL features, so you preserve your options to move to some other database in the future. The main con is that you'd be buying

Re: [PERFORM] Varchar vs foreign key vs enumerator - table and index size

2013-08-31 Thread Vitalii Tymchyshyn
2013/8/31 Łukasz Walkowski lukasz.walkow...@homplex.pl 3. And this part is most interesting for me. Columns browser, eventsource, eventtype, devicetype, operatingsystem contain a small pool of strings - for example for devicetype this is set to Computer, Mobile, Tablet or Unknown. Browser is