Indexes in Django after running syncdb - mysql

Is it there a way to know the current status of mySQL tables in Django after creation through syncdb or do I need to use dbshell?
Another quick question: Suppose I add an index manually after running syncdb, do I have to add index_db to the corresponding field in the model?
Regards

you don't have to. index_db only tells django to add an index when creating the table. adding it subsequently has no effect (though you may want to add it anyway to indicate the presence of and index). if you are using south (you should be) then adding index_db will add index creation to your next migration.

Related

Update sphinx RT index

I'm using RT indexes with sphinx, but actually I'm having troubles updating their structure. For example adding a new column, or a new attribute like charset_table to a RT index that already exists.
What I suppose I need is to reconstruct the index. But the command indexer is useless with this type of index.
I've considered using ALTER TABLE in mysql, but what about the attributes like the one I mentioned?
Well there is a ALTER TABLE in sphinx QL (in latest versions anyway)
http://sphinxsearch.com/docs/current.html#sphinxql-attach (the url is wrong!)
And there is a 'RECONFIGURE' option (see the above page)
... which can be used to an extent to change things like charset_table
But if you want to apply to the whole index, the only way is to delete/truncate the index. Which will pickup the config fresh from the config file, and then you have to explicitly reinsert all the data again.
Readed the spinx document,you'll see you can't modify the structrue with field directly,you must reconstucture the conf and restart the spinx procedure.Good luck

django - default value migration - will this touch database?

I want to make new migration which contains only new default values for some fields. But the database table has >10.000.000 rows (MySQL) and ~200.000 users online.
so what I generally dont know is: does the default value migration (or migrations like choicefield changes) touch the database?
I know that migrations like adding, deleting do touch the database to create/delete stuffs.
would be grateful for some useful tips and links if possible.
No, it doesn't touch the database.
It does not effect the behavior of setting defaults in the database directly - Django never sets database defaults and always applies them in the Django ORM code.
(in fact applying such migrations only marks them as applied and that's all, no real work is performed)

How to check last modify of a field in MySQL

I have a MySQL database preinstalled. I don't wont modify it. Does exist a built in method to check which and when a field has been modified in a specific table?
No, there's no built in method that does this in MySQL.
If you want this type of operation performed in the database, you would need to roll your own solution; and that would require you to modify the database, by adding tables and triggers to audit changes, for example.

What is the best way to make two instances in Solr which use identical schemas?

I got indexed a Mysql database using Solr and everything is perfect. Now i got another database which uses exactly the same schema as my first database but with different data in it.
What i want is to use Solr to index also the second database using the same solr schema that i created for my first database since are completely the same!
I read that Solr cores allows you to run multiple instances that use different configuration sets and indexes, but in my case i got the same exactly configuration, the only thing that changes is the database name.
My question is what is the best way two create two Solr instances that use the same configuration?
Cheers
You could use two cores and share a schema. Just read the Wiki. But in practice you might want to keep the flexibility and just copy the schema for a second core.
How about using only one solr instance but have a field in the schema that contains a value which indicates which db/source the record came from.

SQL Server 2008 Repopulate Index "Update" Option

I have created a single catalog named EntryCatalog. I assigned a table named Entry to the catalog and selected Notes and Title columns (both nvarchar max) with Track Changes set to Automatic.
I did not put anything in the Population Schedule options thinking there has to be some way to have it populate automatically and kind of "manage itself." So in the FTI properties for the Entry table there is an Actions checkbox. I checked that and selected the UPDATE radio button (rather than Incremental or Full) because the docs say "The full-text index is updated whenever the data in the base table is modified." I think that's what I want...does this apply to when inserts are made to the Entry table?
Maybe I'm fundamentally misunderstanding how FTI works. I'm hoping I can just set up a catalog to index the 2 columns in this table and when new records are inserted they are indexed as well automatically. Can this be done, or do you HAVE TO have some kind of scheduling option set up? Is that what repopulating really is?
Thank you.
Well, To implement full-text indexing in SQL Server, you should take the following steps:
Create a full-text catalog, if required.
Create the full-text index.
Modify the list of noise words (SQL Server 2005) or stop words (SQL Server 2008), if necessary.
If required, Modify the thesaurus for the language being used.
"The full-text index is updated whenever the data in the base table is
modified." I think that's what I want...does this apply to when
inserts are made to the Entry table?
Answer: YES
I'm hoping I can just set up a catalog to index the 2 columns in this
table and when new records are inserted they are indexed as well
automatically. Can this be done, or do you HAVE TO have some kind of
scheduling option set up? Is that what repopulating really is?
If I'm not wrong you don't have to any such thing. Things will be managed by SQL Server 2008 automatically. First you need to create Full-Text Catalog and after you create your full-text catalog, you’re ready to create your full-text index. You can then associate the index with the new catalog. Then modify stop words. You are done.
The following link will help you to understand the basic of "Full-Text Indexing in SQL Server".
http://www.simple-talk.com/sql/learn-sql-server/understanding-full-text-indexing-in-sql-server/
Hope this helps!