Reusing deleted variable-size record space

2007-09-30 Thread Renito 73
Hello

I have a database with variable-size fields, some of them may be 
modified/deleted during the usage and administration, so my doubt is: how can 
I compact the records to remove those blank spaces and save space, lets 
say "defragment" the database file so data is continuous and contiguous?

This task should be performed just once or twice a month, so no matter if it 
could take a while.

Is there an internal function to do that? I could copy existing records to a 
new table, delete all the original ones and then insert them back and drop 
the second table but don't like it too much.


Thanks for any suggestion


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Selecting just 'N' first rows

2007-09-09 Thread Renito 73
Hello

How can I send a query that retrieves only the first 'N' rows that match a 
condition? As far as I know you must call mysql_fetch_row() until the last 
row has been processed or the resources allocated won't be free.

Am creating a program in PHP that should retrieve only 'N' records each time a 
query is sent, so I I'm thinking on using mysql_free_result(), but, is it 
safe to free the results even if there are more records remaining that match 
the query conditions?

I need to know how secure could be to read only the first records and free the 
resources, or if there is another way to do the same thing.

Thanks,
Miguel


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Lengtht of TEXT data types

2007-09-02 Thread Renito 73
Hello list

I have doubt on TEXT data types... Checking my notes I see these ones:

TINYTEXT/TINYBLOB (2^8) 255 chars
TEXT/BLOB (2^16) 64K chars
MEDIUMTEXT/MEDIUMBLOB (2^24) 16M chars
LONGTEXT/LONGBLOB (2^32) chars

Well, my doubt consist on this... are these FIXED lengths for the text fields 
or they have variable length that may grow up to that as maximum?

I require to store messages of variable length from 1 to 1024 characters, so 
TINYTEXT is too short and TEXT is too large, so I want to know if it they 
have variable length analog to the VARCHAR type and the client program only 
ensures the messages to have 1024 length...

Thanks for your help

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Joining *3* tables

2006-09-29 Thread Renito 73
Hello list

I have a large database of contacts, but since not all fields are used I 
decided to separate all information in 3 tables to save space like this:

DB_ADDRESS
id int
address char(128)
... three columns more ...

DB_COMPANY
id int
company char(64)

DB_LISTS
id int
list char(16)

Not all addresses have necesarily a company name, so it is separate in a table 
DB_COMPANY. Some other addresses are clasified in lists by category and they 
are grouped in DB_LISTS table.

If I want a report with address and company name pairs I use:

select address,company from DB_ADDRESS left join DB_COMPANY on 
DB_ADDRESS.id=DB_COMPANY.id where DB_COMPANY.id is not null;

If I want a report of address belonging to a certain category:

select address,list from DB_ADDRESS left join DB_LISTS on 
DB_ADDRESS.id=DB_LISTS.id where DB_LISTS.id is not null and 
DB_LISTS.list="providers";

BUT... If I want to generate a report with address, company and list 
(category) how can I join the three tables with a single query? or should I 
first generate a temporal table with the result of the first join and then a 
second one joining the third table?

Thanks for your comments


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]